You are reading a single comment by @d0773d and its replies. Click here to read the full conversation.
  • I've been demoing out different ways to use waveform and come across an issue when using both setInterval and Waveform. the issue is: I am not seeing my temp output in the console.

    Code:

    var w = new Waveform(128/* your buffer size */,{doubleBuffer:false, bits:16});
    setInterval(function() {
      var myarr = w.buffer;
      myarr.sort();
      // cut off first and last 2 elements
      var view = new Uint16Array(myarr.buffer, 2/*sizeof(uint16)*/*2, n-4);
      var vOut = E.getAnalogVRef() * E.sum(view)/(view.length*65536); // if you attached VOUT to Ao
      var vZero = 0.4;
      var tCoeff = 19.5 / 1000;
      var tempinc = (vOut - vZero) / tCoeff;
      var tempinf = tempinc * (9 / 5) + 32;
      console.log("Temp in C: " + tempinc);
      console.log("Temp in F: " + tempinf);
      //console.log(E.sum(view)/(view.length*6­­5536));
      // start it again
      w.startInput(A0,2000 /* Samples per second */);
    }, 1000*150/2000 /* so slightly over the 128/2000 sec required for the waveform*/);
    

    I tried setting the time higher, but I am still getting the same issue. I did, however, place a console.log ("start!") Inside of the startInterval as the first line and start! was sent to the Console successfully.

About

Avatar for d0773d @d0773d started