I'm very confused by the JS in Espruino for many reasons. I want to start off addressing this simple concern that I believe will also be useful to many others.
I want to address pins whose names are stored in variables to make the code considerably cleaner.
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.
I'm very confused by the JS in Espruino for many reasons. I want to start off addressing this simple concern that I believe will also be useful to many others.
I want to address pins whose names are stored in variables to make the code considerably cleaner.
Consider this:
That's pretty amateur. It would be some much cleaner/DRYer to do:
It would be splendid if that would work in the same way this works:
But it doesn't. It seems to require a limited switch/case.
So, what and where are these LED variables an how can I address them programmatically?