You are reading a single comment by @user6438 and its replies. Click here to read the full conversation.
  • Hi. My first evening with Espruino... and my first program seems to have a lot in common with this thread...

    i=0;
    lastTime=getTime();
    function f() {
      now=getTime();
      if ((now-lastTime)>0.2) {
        lastTime=now;
        i = (i+1) % 8;
        digitalWrite(LED1, i&1);
       digitalWrite(LED2,i&2);
       digitalWrite(LED3,i&4);
      }
    }
    setWatch(f,BTN,{repeat:true,edge:'rising'});
    

    The intention is that for every press of the button the LEDs count in binary from 000 to 111...

    Seems to work! Thanks!

About

Avatar for user6438 @user6438 started