Hardware Reference
In-Depth Information
If you got it right, the LED should have turned on! Now turn it off:
root@clanton:/sys/devices/virtual/gpio/gpio39# echo 0 > value
When you toggled pin 13 with Arduino code, you also controlled the on-board
LED pictured in Figure 2-8 . Why didn't it turn on and off now? That's because
the on-board LED on Galileo is connected to Arduino pin 13 through software
only. It's actually on its own Linux GPIO signal. If you want to try blinking it,
it's controlled with Linux signal name gpio3.
Because you can read and control Galileo's pins by reading and writing files
within the Linux environment, it opens up a whole new realm of power and
flexibility, one that previous Arduino boards didn't have. As the Galileo soft-
ware matures, it's likely that it will take advantage of this ability and further
empower users. For now, consider yourself in somewhat uncharted territory
and report back what you find.
Taking It Further
This chapter armed you with the ability to control digital output pins by writ-
ing their values to be high or low or using pulse width modulation to send
pulses of high and low signals. Along the way, you learned a lot of program-
ming concepts that you'll use throughout your work with Galileo.
Here are a few ideas for how you can apply what you've learned in this chap-
ter:
• Create an LED light show timed to sync up with a song using digital
Write() , analogWrite() , and delay() .
• Create a sketch that pulses an LED to communicate a message using
Morse code.
• Strap a small hourglass to a servo's arm and see if you can program the
timing on the Galileo so that it flips the hourglass over immediately after
all the sand falls through.
Here are some additional resources in case you'd like to learn more about the
concepts covered in this chapter:
• There's an example in the Arduino IDE that shows you how to blink an
LED without using the delay() function. This will come in handy to learn
how to set something to run on an interval without blocking other oper-
ations, which is what delay() does. To try it out, click File Exam-
ples 02.Digital BlinkWithoutDelay.
• My friend Collin made a great video explaining pulse width modulation .
• The data sent via serial is in the ASCII character encoding scheme and
the byte values for each character can be represented in a few different
Search WWH ::




Custom Search