====== IO-Warrior Remote Control ====== The [[http://www.codemercs.com/en/io|IO-Warrior]] is an USB Input/Output device by German manufacturer Code Mercenaries. It is an HID device that does not require any special drivers, and there are multiple versions with a different number of digital I/O pins available. Each pin can be used as either an input pin (to execute remote control commands), or as an output pin (from a script). ===== Configuration ===== Open the standalone config app or the Control Panel, go to the //Remote Control// page, and add a new //IO-Warrior// remote. In the configuration dialog, first select the desired IO-Warrior device from the list. mAirList will open the device and query the number of pins, which may take a few seconds. {{ :config:remotecontrol:pasted:20160830-140615.png?400 }} For each pin, you can select or type a [[reference:remote_control_commands|remote control command]] for the event that the pin goes on or off, respectively. ====== Scripting ====== Pins can be used as output pins from a script. You can access an IO-Warrior remote through the following function which will return a reference to an ''IIOWarriorRemote'' interface: function IOWarriorRemote(iIndex: integer): IIOWarriorRemote; Remotes are 0-based, so for example, ''IOWarriorRemote(0)'' access the first IO-Warrior remote in the system. The ''IIOWarriorRemote'' interface provides two functions: function GetPort(iPort: integer): boolean; procedure SetPort(iPort: integer; iValue: boolean); ''GetPort'' will return the current state of any port. (The first port has index 0.) ''SetPort'' will set the state of a port, using that pin as an output pin. Note that once this function has been called for a pin, that particular pin will be an output pin and cannot be used as an input pin anymore until you power-cycle the IO-Warrior device. A complete call for switching on (setting) port 9 on the first I/O-Warrior unit then should look like this: IOWarriorRemote(0).SetPort(9, true); For swtiching off, the value ''true'' should be replaced by ''false''.