Enabling GPIO control
To get access to an GPIO pin, first, write the GPIO number to /sys/class/gpio/export
echo 7 [gt] /sys/class/gpio/export
Now you should find a directory in /sys/class/gpio to access your GPIO pin. Write in or out to direction to change the direction of the pin:
echo out [gt] /sys/class/gpio/gpio7/direction
The value (0 for off, 1 for on) of the pin is in the value file. To read or change it, read the file or write to it.
echo 1 [gt] /sys/class/gpio/gpio7/value
cat /sys/class/gpio/gpio7/value
The list of GPIO numbers can be found below.
CPU Module
The two color led can be controlled by two GPIO pins.
Color | Bank and pin | GPIO Number | Notes |
---|---|---|---|
Green | 2-4 | 68 | output is inverted, 0 is on |
Red | 2-5 | 69 |
Verno 3/4/Cadun
There are 8 GPIOs on J12 with a signal level of 3.3V and 14 more on J16 using the GPIO expander.
Connector | Pin | Signal | Bank and pin | GPIO Number |
---|---|---|---|---|
J12 | 4 | GPIO_0 | 0-7 | 7 |
J12 | 8 | GPIO_2 | 1-21 | 53 |
J12 | 12 | GPIO_4 | 2-19 | 83 |
J12 | 14 | GPIO_5 | 3-9 | 105 |
J12 | 16 | GPIO_6 | 2-18 | 82 |
J12 | 18 | GPIO_7 | 3-10 | 106 |
J12 | 20 | GPIO_8 | 0-13 | 13 |
J12 | 22 | GPIO_9 | 0-12 | 12 |
J16 | 3 | GPIO_I2C_0 | 128 | |
J16 | 4 | GPIO_I2C_8 | 136 | |
J16 | 5 | GPIO_I2C_1 | 129 | |
J16 | 6 | GPIO_I2C_9 | 137 | |
J16 | 7 | GPIO_I2C_2 | 130 | |
J16 | 8 | GPIO_I2C_10 | 138 | |
J16 | 9 | GPIO_I2C_3 | 131 | |
J16 | 10 | GPIO_I2C_11 | 139 | |
J16 | 11 | GPIO_I2C_4 | 132 | |
J16 | 12 | GPIO_I2C_12 | 140 | |
J16 | 13 | GPIO_I2C_5 | 133 | |
J16 | 14 | GPIO_I2C_13 | 141 | |
J16 | 15 | GPIO_I2C_6 | 134 | |
J16 | 17 | GPIO_I2C_7 | 135 |
Lothron 3
The Lothron 3 has 8 accessible GPIO pins on J25.
Connector | Pin | Signal | Bank and pin | GPIO Number |
---|---|---|---|---|
J25 | 11 | GPIO_0 | 0-7 | 7 |
J25 | 13 | GPIO_2 | 1-21 | 53 |
J25 | 15 | GPIO_4 | 2-19 | 83 |
J25 | 16 | GPIO_5 | 3-9 | 105 |
J25 | 17 | GPIO_6 | 2-18 | 82 |
J25 | 18 | GPIO_7 | 3-10 | 106 |
J25 | 19 | GPIO_8 | 0-13 | 13 |
J25 | 20 | GPIO_9 | 0-12 | 12 |