The CreateDigitalInput function creates an object which manages Digital input for a particular pin on the IOIO board.
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 input but be careful not to supply voltage levels outside the allowed range for each pin, or else you might damage your IOIO board. (Most pins are 3.3V tolerant but those marked with a circle are 5V tolerant)
See http://github.com/ytai/ioio/wiki/Digital-Io for more details.
If you leave out the mode parameter the pin will be opened in normal "Floating" mode. Setting the mode parameter to "PullUp" will cause the pin to be gently 'pulled up' to 3.3V and setting it to."PullDown" will cause the pin to be gently 'pulled down' to 0V.
Use the Read function of the DigitalInput Object to read the pin state, which is returned as logical true or false. (true = High, false = Low).
The following example makes use of the JavaScript setInterval function to repeatedly read the value on pin 12, every 3 seconds.
You can also use the WatchForValue and SetOnValue functions to have one of your own functions called when a pin changes to a given state.
This is useful if the pin only goes high for a fraction of a second which might be missed if you simply keep checking the current value with a timer. (Your function is only called once, so you will need to call the WatchForValue function again to reset the watch).