• Hi, I was trying to set led to turn it on or off depends of how long I press the button, I used your code above.
    my code

    setWatch(function(e){
        var isLong = (e.time-e.lastTime)>0.4;
        print(isLong.toString());
        onD23();
          // ...
        }, BTN, {repeat:true, debounce:50, edge:"falling"});
    
    setWatch(function(e){
        var isLong = (e.time-e.lastTime)>0.4;
        print(isLong.toString());
        offD23();
          // ...
        }, BTN, {repeat:false, debounce:50, edge:"falling"});
    
    
    function onD23(){
      digitalWrite(D23,1);
      setTimeout(function () { digitalWrite(D23,0); }, 1000);
    }
    
    function offD23(){
      digitalWrite(D23,0);
      setTimeout(function () { digitalWrite(D23,1); }, 1000);
    }
    

    but I have same sequence on the board, when press the button my LED(D23) is ON for a 1000ms and then off, so when I press button short or long time not change nothing

About

Avatar for bigplik @bigplik started