Here is one more I named LED. It is a very simple class the can handle three led states:
on / off / blink( duration in ms for off and on)
Some led are switched on with Pin.write(1) and some with Pin.write(0) thats why the constructor needs two parameter, one for the pin and one for the value used to switch the led on.
/* Pico
LED1 red
LED2 green
*/
led1 = new LED(LED1, true);
led1.blink(500);
led2 = new LED(LED2, true);
led2.blink(250);
// stop after 10 sec
setTimeout(function(){led1.off();led2.off();},1E4);
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.
Here is one more I named LED. It is a very simple class the can handle three led states:
on / off / blink( duration in ms for off and on)
Some led are switched on with Pin.write(1) and some with Pin.write(0) thats why the constructor needs two parameter, one for the pin and one for the value used to switch the led on.
Code to test class LED on a Pico
Hope it is useful ;-)