You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • Using edge:0 was my first step. Thats were the problem started.
    I changed to 2 watches to have the option to use different debounce for falling and for raising.
    Anyway, I switched back to one watch for testing.

    function initWP(){
      var arr = new Uint8Array(100),pnt = 0,pulsePort = D3;
      pulsePort.mode('input_pullup');
      function pulseHnd(e){arr[pnt++] = e.state;}
      function logPulse(){
        console.log(new Uint8Array(arr.buffer,0,pnt));
        clearWatch();
      }
      setWatch(pulseHnd,pulsePort,{repeat:true­,edge:0,debounce:5});
      setTimeout(logPulse,5000);
    }
    

    Problem stays.
    Next, based on a hint from @MaBe, used 2 wires connecting on a breadboard to simulate pulses instead of my rotary and got similiar problem. This time I've falling edges without raising between (2nd and 3rd example)

    initWP()
    =undefined
    new Uint8Array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
    >initWP()
    =undefined
    new Uint8Array([0, 0, 1, 0, 1, 0, 1, 0, 1])
    >initWP()
    =undefined
    new Uint8Array([0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0])
    
About

Avatar for JumJum @JumJum started