Difference between revisions of "Transclusion: Debian: GPIO"
(New page: Linux provides simple and convenient GPIO access via {{filename|sysfs}} interface. A GPIO should be exported using {{filename|/sys/class/gpio/export}}. After the GPIO is exported it is pos...) |
(No difference)
|
Revision as of 10:52, 15 February 2017
Linux provides simple and convenient GPIO access via sysfs interface. A GPIO should be exported using /sys/class/gpio/export. After the GPIO is exported it is possible to change its direction and value using /sys/class/gpio/gpioX/direction and /sys/class/gpio/gpioX/value attributes.
Example
The following example demonstrates how to configure GPIO 140 as output and set value to high:
# echo 140 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio140/direction # echo 1 > /sys/class/gpio/gpio140/value
![]() |
The above example assumes that the pinmux configuration of the corresponding pin is set to GPIO mode and the GPIO 140 is not requested in the Linux kernel. |