Skip to content

Manually Controlling GPIO Pins (Pucks)

Alexander Crain edited this page Sep 11, 2023 · 2 revisions

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:

image

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

Clone this wiki locally