So far Espruino has been awesome but as a beginner I have some issues wrapping my head around targeting the pins. In the documentation I can see
However there is no mention of the buildin led on the board. How can I select that?
Also I don't know how I can select the other pins for example S1 S2 EN and RX.
you should be able override it just like that var LED1 = NodeMCU.D2; to put NodeMCU.D2 on LED1 (or just any other (var) name). Since it is a pin, it 'understands' .set() and .reset() and all other pin related 'methods' as documented in https://www.espruino.com/Reference#Pin documentation. Since Espruino boards have the LEDs known and (may) preset pin mode, you may need to do that too with the assignment, such as pinMode(NodeMCU.D2,"output"). --- Let us know if it works... your board's built-in LWD - if there is one on any of the pins - or to which pin you will connect the LED w/ resistor - will define the code detail.
var LED1 = NodeMCU.D2;
I actually managed to get the built-in LED on with :
var led = NodeMCU.D4; // built-in LED
var state = true; // LED switched on by default
var duration = 500; // blink the LED every 500 ms
state = !state; // toggle LED state
Thank you so much for guiding me
...very self explanatory! Thanks for sharing.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem