public interface DigitalOutput extends Closeable
A digital input pin can be used to generate logic-level signals.
DigitalOutput instances are obtained by calling
IOIO.openDigitalOutput(DigitalOutput.Spec, boolean).
The value of the pin is set by calling write(boolean).
The instance is alive since its creation. If the connection with the IOIO
drops at any point, the instance transitions to a disconnected state, in
which every attempt to use the pin (except Closeable.close()) will throw a
ConnectionLostException. Whenever Closeable.close() is invoked the
instance may no longer be used. Any resources associated with it are freed
and can be reused.
Typical usage:
DigitalOutput led = ioio.openDigitalInput(2); // LED anode on pin 2. led.write(true); // turn LED on. ... led.close(); // pin 2 can now be used for something else.
| Modifier and Type | Interface and Description |
|---|---|
static class |
DigitalOutput.Spec
A digital output pin specification, used when opening digital outputs.
|
void write(boolean val)
throws ConnectionLostException
val - The output. true is logical "HIGH", false is logical "LOW".ConnectionLostException - The connection with the IOIO has been lost.