As above - there are two separate circuits, in and out.
Yes, you can read from the OUT register and find out what you wrote. But that's not what digitalRead does, since it'd mean it wouldn't be able to read the actual value on the pin.
If you care about this and for some reason can't keep track of it yourself, you can use peek to look at the register yourself. Internally Espruino can figure it out because it needs it for pin.toggle but it's not exposed any other way
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.
As above - there are two separate circuits, in and out.
Yes, you can read from the OUT register and find out what you wrote. But that's not what
digitalRead
does, since it'd mean it wouldn't be able to read the actual value on the pin.If you care about this and for some reason can't keep track of it yourself, you can use
peek
to look at the register yourself. Internally Espruino can figure it out because it needs it forpin.toggle
but it's not exposed any other way