• I modified my code according to your example and the time required to capture 2*70 readings with time stamp dropped from 35ms to 21ms. This is a significant improvement, but I am still interested in reducing the time required for this measurement. The function that I am working on is a simple maximum power point tracking for a solar panel powered charger where partial shade occurs frequently and rapidly. The faster I can capture the data, the more accurately the charger will track the maximum power point. This allows the charger to harvest more of the available energy from the panel.

    function read() {
      var t=getTime();
      var d = [];
      for (var i=samples; i>0; i--) d.push([getTime(),analogRead(C1),analogRĀ­ead(C5)]);
      for (i in d) d[i][0]-=t;
      return d;
    }
    function send() {
      for (var k=0; k<samples; k++) {
        print (data[k]);
      }
    }
    var samples=70;
    var data= read();
    send();
    
About

Avatar for tage @tage started