• While running the following (example) code to read IR signals

    digitalWrite(D2,0);
    pinMode(D1,"input_pullup");
    var d = [];
    setWatch(function(e) {
       d.push(1000*(e.time-e.lastTime));
    }, D1, {edge:"both",repeat:true});
    
    
    var lastLen = 0;
    setInterval(function() {
      if (d.length && d.length==lastLen) {
        d.shift(); // remove first element
        console.log(d.map(a=>a.toFixed(1)).toString());
        d=[];
      }
      lastLen = d.length;
    },200);
    
    
    

    I get this after a few reads:

    .1,4.6,0.6,0.6,0.6,1.7,0.6,1.7,0.6,1.7,0.5,0.6,0.6,1.7,0.6,1.7,0.6,1.7,0.6,1.7,0.6,1.7,0.6,1.7,0.5,0.6,0.6,0.6,0.6,0.6,0.6,0.5,0.6,1.7,0.6,1.7,0.6,0.6,0.6,1.7,0.6,0.6,0.6,0.6,0.6,0.5,0.6,0.6,0.6,0.5,0.6,0.6,0.6,0.6,0.6,1.7,0.6,1.7,0.6,0.5,0.6,0.6,0.6,0.5,0.6,1.7,0.6,40.0,9.1,2.2,0.6,97.2,9.1,2.2,0.6
    4.0,3.9,0.6,0.9,0.6,0.8,0.6,0.8,0.6,0.8,0.6,0.9,0.6,0.9,0.6,0.9,0.6,0.8,0.6,0.9,0.6,0.8,0.6,0.9,0.6,0.8,0.6,0.8,0.6,0.9,0.6,0.9,0.6,0.9,0.6,0.8,0.6,0.8,0.6,0.9,0.6,0.9,0.6,0.8,0.6,0.8,0.6,1.9,0.6,0.9,0.6
    ERROR: Ctrl-C while processing watch - removing it. Execution
    Interrupted during event processing. New interpreter error:
    CALLBACK,MEMORY ERROR: Ctrl-C while processing interval - removing it.
    Execution Interrupted during event processing.

    What seems to be the issue?

    How do I go about to debug this?

    Thanks!

About

Avatar for user104751 @user104751 started