ioio.lib.api
Interface DigitalOutput

All Superinterfaces:
Closeable

public interface DigitalOutput
extends Closeable

A pin used for digital output.

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.
 


Nested Class Summary
static class DigitalOutput.Spec
          A digital output pin specification, used when opening digital outputs.
 
Method Summary
 void write(boolean val)
          Set the output of the pin.
 
Methods inherited from interface ioio.lib.api.Closeable
close
 

Method Detail

write

void write(boolean val)
           throws ConnectionLostException
Set the output of the pin.

Parameters:
val - The output. true is logical "HIGH", false is logical "LOW".
Throws:
ConnectionLostException - The connection with the IOIO has been lost.