GPIO for NanoPi

From wiki.ferrari.mo.it
Revision as of 13:21, 1 March 2020 by Admin (talk | contribs) (Created page with "== GPIO (in/out) for NanoPi == Note: the test environment is a NanoPi K1 Plus with FriendlyCore installed in eMMC, kernel 4.14.x . To enable a pin, execute: echo X > /sys/...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GPIO (in/out) for NanoPi

Note: the test environment is a NanoPi K1 Plus with FriendlyCore installed in eMMC, kernel 4.14.x .

To enable a pin, execute:

echo X > /sys/class/gpio/export

where X is the number of the linux gpio corresponding to the pin you want to enable.

For example, if we want to enable pin N. 37, according to the table in http://wiki.friendlyarm.com/wiki/index.php/NanoPi_K1_Plus#Diagram.2C_Layout_and_Dimension , we need to execute:

echo 9 > /sys/class/gpio/export

A new /sys/class/gpio/gpio9 directory will appear.

In the same way, to disable the pin we need to execute:

echo 9 > /sys/class/gpio/unexport

and the directory/symbolic link gpio9 will disappear.

To set the