Skip to Content
GNU/Linux Rapid Embedded Programming
book

GNU/Linux Rapid Embedded Programming

by Rodolfo Giometti
March 2017
Intermediate to advanced
732 pages
15h 24m
English
Packt Publishing
Content preview from GNU/Linux Rapid Embedded Programming

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:

Bash

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Embedded Programming with C++17

Hands-On Embedded Programming with C++17

Maya Posch

Publisher Resources

ISBN: 9781786461803Supplemental Content