メインコンテンツにスキップ

GPIO pin control

The Duos serial number is the NUM column of J3 arrangement.

The Duo serial number is the NUM column of GPIO pin distribution.

The serial number of Duo256M is the NUM column of GPIO pin distribution.

The serial number of Duo Module 01 is the NUM column of 26 PIN pin header.

Take Duos, GPIO466 as an example,

  1. Perform the following operations to configure GPIO
$ cd /sys/class/gpio

$ echo 466 > export

You can run the command ls /sys/class/gpio to list the GPIO directory, check whether gpio466 appears, and confirm that the export is successful.

Run the command echo 466 > unexport to cancel the export of the gpio466 pin.

  1. Set the direction of GPIO

Run the command echo "out" > gpio466/direction to set the gpio466 direction to output.

Run the command echo "in" > gpio466/direction to set the gpio466 direction to input.

You can check the set direction by running the command cat gpio466/direction.

  1. Set the GPIO level

Run the command echo "1" > gpio466/value to set the gpio466 level to high.

Run the command echo "0" > gpio466/value to set the gpio466 level to low.

You can view the set level by running the command cat gpio466/value.