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!
Search Options
Types to Display
Espruino
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi. My first evening with Espruino... and my first program seems to have a lot in common with this thread...
The intention is that for every press of the button the LEDs count in binary from 000 to 111...
Seems to work! Thanks!