Manually Controlling GPIO Pins (Pucks) - Carleton-SRCL/SPOT GitHub Wiki

Sometimes, it can be convenient to circumvent the GUI and directly control the GPIO pins on the platforms. This can be done using the following commands while being remotely connected to the platforms. In the following sample code, 428 corresponds to the GPIO pin; changing this number will change with pin you are controlling. Here is a map of the pins, taken from this link:

Enabling Pins

echo 428 > /sys/class/gpio/export

Setting Pin Direction

To write to a pin:

echo out > /sys/class/gpio/gpio428/direction

To Read the state of a pin:

echo in > /sys/class/gpio/gpio428/direction

Set Pin State

To set a pin HIGH:

echo 1 > /sys/class/gpio/gpio428/value

To set a pin LOW:

echo 0 > /sys/class/gpio/gpio428/value

Checking which Pins are Active

ls /sys/class/gpio/

Disabling Pins

echo 428 > /sys/class/gpio/unexport