• @bigplik you can't use a for loop for that kind of thing - because getADC is asynchronous.

    You need to use callbacks, so that you issue the next reading only after you got the last one. For instance:

    var idx = 0;
    var array = new Float32Array(10);
    function getValue(value) {
      array[idx] = value;
      idx++;
      if (idx<array.length) 
        ads.getADC(0, getValue);
    } 
    
    ads.getADC(0, getValue);
    
    
About

Avatar for Gordon @Gordon started