That's intended - digitalRead automatically sets the pin state to input when you use it (in the same way you'd be surprised if digitalWrite didn't change the pin state to an output).
You can manually set the pin mode with pinMode though, and then it won't change state after that so you can do a digitalRead while leaving the LED on.
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.
That's intended -
digitalRead
automatically sets the pin state to input when you use it (in the same way you'd be surprised ifdigitalWrite
didn't change the pin state to an output).You can manually set the pin mode with
pinMode
though, and then it won't change state after that so you can do adigitalRead
while leaving the LED on.