Use a Passive Infra Red (PIR) module or a switch and trip wire. PIR can be found for about $3 and switchers for... less ???
Wire the IOIO board so that your input in will ether be high or low. High 3.3v Low 0v. You will need to use a pull up or pull down resistors.
setup() is called every time a connection with IOIO has been established
protected void setup() throws ConnectionLostException
showVersions(ioio_, "IOIO connected!");
led_ = ioio_.openDigitalOutput(0, true);
pir_ = ioio_.openDigitalInput(48, Mode.FLOATING);
called repetitively while the IOIO is connected
Check Us out on Social Media