“Digital inputs return 0 or 1
As do digital outputs, and indeed all non-analog uses of the pin – i.e., pin.read() will return the actual state of the pin even if it’s configured for output, SPI, UART, etc.”
is this still the case for digital outputs?
Doing a simple: hardware.pin9.configure(DIGITAL_OUT_OD_PULLUP); hardware.pin9.write(1); server.log(hardware.pin9.read());
logs 0, when I would obviously expect 1. Is this a bug, or am I missing something fundamental?
Well, the pin could be 0 there. You’re configuring an open-drain output, so writing ‘1’ to it simply turns off the driver and uses the internal (weak) pullup to set the state.
If you have something with a high load on the pin, say a relay without a transistor to drive it, then it will log as zero because even though the imp is trying to drive the pin high, it can’t put enough current in to bring the pin up to logic 1 level.