Back

CreateDigitalOutput

The CreateDigitalOutput function creates an object which manages digital output for a particular pin on the IOIO board.

 out = ioio.CreateDigitalOutput( pinNum, startVal, mode );

Put the number of the pin you wish to use in the pinNum parameter (Any of the 48 pins can be used as a digital output). The startVal parameter should contain a true or false value depending on what state you wish the pin to be in initially (Hi=true, Lo=false).

If you leave out the mode parameter the pin will be opened in normal mode where logic Hi = 3.3V and Lo = 0V. Setting the mode parameter to "OpenDrain" will enable a mode where logic Hi = Disconnected and Lo = 0V.

See http://github.com/ytai/ioio/wiki/Digital-Io for more details.

Example - Output on Pin 12

function ioio_OnConnect()
{
  out = ioio.CreateDigitalOutput( 12, true );
}
  Copy   Copy All