You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I think you may still be able to get it faster. I'd forgotten that the code I suggested triggered on both edges. You may be able to use 'lastTime' to measure the pulse width, while only triggering on the falling edge:

    function sigOff(e) {
      var d=e.time-e.lastTime;
      if (d>0.0004 && d<0.0013) n+=(d>0.0008)?1:0;
      else{
        if (n.length==32) console.log(n);
        n="";
      }
    }
    
    wr=setWatch(sigOn,C6,{repeat:true,edge:"­falling"});
    

    You may also be able to use debounce to remove the check for small pulses, but I'd try that code first. it does rely on finding an abnormal pulse after the data is sent, but you can pretty much rely on that - otherwise I guess you could have an interval that checked the length of n every 100ms.

    I'd be interested to know how it goes. If we get something working well, I'd really like to turn it into a module that others can use.

About

Avatar for Gordon @Gordon started