Actually I am not frustrated but trying to figure out how can I use esp8266 with espruino firmware, especially digitalRead() and digitalWrite() correctly. Anyways, it seems to be a bit weird that on
LED does gets turned off. I tried on multiple esp8266 board but same results.
Feels much more inconvenient but it works as mentioned by @MaBe.
And I am referring https://www.espruino.com/Reference
The Espruino reference is accurate for official boards. The ESP8266, being a community port and manufactured by parties other than Espruino, may wire things up differently as @Robin has mentioned several times.
You seem to be under the impression that a "1" or a "true" means on, while a "0" or a "false" means off. Those really are just conventions, and will do different things depending on how things are wired. Sending "true" just means pulling the gpio up, while sending "false" means pulling it down (to ground).
There's a good explanation on stackoverflow: https://electronics.stackexchange.com/questions/20740/why-are-pull-up-resistors-more-common-than-pull-down-resistors which talk about switches; however since we're talking about LEDs one possible reason is that that in this case LED is wired to be pulled up in hardware; hence when setting the gpio low the LED turns on (because the circuit is complete) while setting the gpio high the LED turns off (because there is no voltage potential anymore).
We don't have the schematics so we can't know for sure. The official boards have schematics of course so we can inspect that and know for sure.
That said, there are ways to "invert" the logic so it's more "intuitive" but that involves possible issues with backwards compatibility on future firmware upgrades. Another one is to update the documentation on the ESP8266 specific page to mention this fact (then again, with all the different manufacturers of ESP8266 modules how do we know for sure which one we're working with?)
© Espruino, powered by microcosm.
Report a problem