Getting access to GPIOs
Now let's look at how we can get access to GPIOs using both the command line (using Bash) and then using the C language.
Bash
Now it's time for an example. A very simple usage is the following one, where we use the gpio91
of the Wandboard to turn an LED on and off. The circuitry is reported in the following figure:
To control the LED, we must set the line as the output, so we should write out
in the /sys/class/gpio/gpio91/direction
file, but if we wish to set the LED to a precise state by default, it is better to write low
, as show here:
root@wb:~# echo low > /sys/class/gpio/gpio91/direction
Note
You can now observe that the ...
Get GNU/Linux Rapid Embedded Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.