Hardware Reference
In-Depth Information
system, make network connections, read and write the pins, and much more.
You're going to use a few Linux commands to turn a pin into an output and
then set it to high.
From the command line, first log in as root (you don't need to do this if you're
connected via serial):
/ # login root
root@clanton:~#
Next use the command cd to change to the directory /sys/class/gpio :
root@clanton:~# cd /sys/class/gpio/
Now list the contents of that directory with the command ls :
root@clanton:/sys/class/gpio# ls
export gpio19 gpio27 gpio38 gpio46 gpiochip0
gpio0 gpio20 gpio28 gpio4 gpio47 gpiochip16
gpio1 gpio21 gpio29 gpio40 gpio48 gpiochip2
gpio14 gpio22 gpio30 gpio41 gpio49 gpiochip8
gpio15 gpio23 gpio31 gpio42 gpio50 unexport
gpio16 gpio24 gpio32 gpio43 gpio51
gpio17 gpio25 gpio36 gpio44 gpio54
gpio18 gpio26 gpio37 gpio45 gpio55
This is a listing of files and directories (or folders) for working with the differ-
ent pins on Galileo (it's been formatted to fit this page nicely, so it may not
look exactly like your output). Within the Linux environment, you can write
to a particular file to control a pin and read from a file to get the pin's state.
The letters GPIO above stand for general purpose input/output , which means
that the pins can be configured to do many different things such as digital
output, digital input, analog output, and analog input, to name a few.
On other Linux development boards, you normally would not
necessarily see all the GPIO pins in /sys/class/gpio . However,
since you've uploaded and launched an Arduino sketch to get
Telnet running, the sketch exported those pins and configured
them for use already.
The listing of the pin numbers in /sys/class/gpio does not match the pin
numbers you use within your Arduino code or the numbers printed on the
board. Table 3-3 shows which Arduino pin number matches which Linux GPIO
signal number.
 
Search WWH ::




Custom Search