Tips for using a Pi to read and write to I/O

Opto 22 I/O modules use negative true logic (a zero bit means On and a 1 bit means Off).
When you read and write to I/O modules, 0 is On and 1 is Off.
You can both read and write to output modules.
For input modules, you perform reads.
If you accidentally write to an input module, no problem—nothing will happen.
Before using a terminal emulator to read and write to an I/O module, you must configure its associated GPIO pin as an input or output. The Opto 22 Pin-to-Module diagram can help.


If the GPIO pin is mapped to an input module, make sure to configure it as input; if it’s mapped to an output module, make sure to configure it as output.
Once you configure the GPIO pin, you don’t need to change it (unless you swap out the Pi or connect the same carrier board to a rack with different I/O).
You can use any Pi operating system and programming language to read and write to I/O points.

Examples

For more samples and tips, visit:


For a mapping diagram and overlay for your Pi, see Pin-to-Module Mapping.