LEDx.set/reset functions help - were they available before?
Yes, pretty much right since the start :)
I've resisted putting toggle in so far because it's only use is really for LEDs. People think it's just write(!read()) but in reality it's a bit more nuanced than that because read reads the input register, which is actually different to the current output state (think what happens in opendrain mode).
What @allObjects is suggesting (this.write(pin, !this.read();) should work ok for LEDs though. It should be pretty easy to upload that beforehand?
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.
Yes, pretty much right since the start :)
I've resisted putting toggle in so far because it's only use is really for LEDs. People think it's just
write(!read())
but in reality it's a bit more nuanced than that becauseread
reads the input register, which is actually different to the current output state (think what happens inopendrain
mode).What @allObjects is suggesting (
this.write(pin, !this.read();
) should work ok for LEDs though. It should be pretty easy to upload that beforehand?