Working with discrete outputs in Linux

The discrete output can be in one of two states:

Status

Description

0

Output off (relay off)

1

Output on (relay on)

Initialization:

Note

By default in Armbian Linux the GPIO pins are configured to sysfs mode at system boot and no additional configuration is required.

cd /sys/class/gpio
echo 456 > export
echo out > gpio456/direction

If you want to invert the output logic:

echo 1 > gpio456/active_low

Enable output:

echo 1 > gpio456/value

Output shutdown:

echo 0 > gpio456/value