The CP-IO13-4C is an IO board accessory for the ComfilePi consisting of 7 digital inputs, 6 digital outputs, corresponding indicator LEDs, 2 RS-232C ports, all exposed through screw terminals. It can be mounted to the rear panel of the CPi-C070WR4C panel PCs.
The following is an example project illustrating how to program the CP-IO13-4C in C# or VB.Net using the Mono Framework.
This example PInvoke's the pigpio library. For more information see the PInvoke documentation and the pigpiod C interface documentation
.NET Core drivers can be found at the .NET IoT Libraries API Reference.
The pigpio library also has a Python interface.
The following is an example illustrating digital inputs and outputs:
import pigpio pi = pigpio.pi() pi.set_mode(6, pigpio.INPUT) pi.set_mode(19, pigpio.OUTPUT) while True: if pi.read(6): pi.write(19, 1) else: pi.write(19, 0) pi.stop()
The CP-IO13-4C pins are connected to the ComfilePi CPi-C's GPIO header as shown below.
Inputs: GPIO 6, 7, 10, 11, 16, 17, 18
Outputs: GPIO 19, 20, 21, 22, 23, 24
It may be necessary to modify the ComfilePi's initial GPIO output state to prevent the ComfilePi from turning the outputs ON when the ComfilePi boots.
Modify the ComfilePi's /boot/config.txt file with the following configuration to set the initial IO state. See GPIO control in config.txt for more information.
gpio=6-7=ip gpio=10-11=ip gpio=16-18=ip gpio=19-24=op,pd,dl
To intitialize /dev/serial2
and /dev/serial3
add the following to the /boot/config.txt file.
dtoverlay=uart3,txd3_pin=4,rxd5_pin=1 dtoverlay=uart4,txd4_pin=8,rxd9_pin=1