Avatar for user6438

user6438

Member since Feb 2014 • Last active Feb 2014
  • 0 conversations
  • 1 comments

Most recent activity

  • in JavaScript
    Avatar for user6438

    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!

Actions