• @allObjects - wow - this is very helpful and can be used as button extension for Puck.js

    I use it like this

    /* 
    S :  single short touch to switch on 
    SS : double short touch to switch off
    */  
    var SWBtn =require("https://raw.githubusercontent.com/muet/EspruinoDocs/master/modules/SWButton.js");
    
    var mySWBtn = new SWBtn(function(k){
          console.log("BTN1 detected " + k); // log key press pattern
          if (k === "S"  )
            LED3.set();
          else if (k === "SS" ) 
            LED3.reset();
    });
    

    Thanks for sharing !

About

Avatar for MaBe @MaBe started