Oh, if it works with pinMode() set to output, but not with pinMode() not set, it's not what I thought it was.
I think I see what's happening.... I'll bet it sets it to input to read it, but because there's a load on the pin, the voltage is dropping as soon as it's no longer an output - so fast that by the time it reads it, it's no longer high anymore...
Yeah, this behavior is kinda ugly. I always explicitly set pinMode() so I don't run into this sort of behavior.
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.
Oh, if it works with pinMode() set to output, but not with pinMode() not set, it's not what I thought it was.
I think I see what's happening.... I'll bet it sets it to input to read it, but because there's a load on the pin, the voltage is dropping as soon as it's no longer an output - so fast that by the time it reads it, it's no longer high anymore...
Yeah, this behavior is kinda ugly. I always explicitly set pinMode() so I don't run into this sort of behavior.