Hardware Reference
In-Depth Information
Another reason to refer to the values as variables is that if you need to change
your pin numbers, you won't need to dig through all the lines of your code
and make changes. You'll only need to change a single line, and that will be
reflected throughout the rest of your sketch.
It may seem like extra work to do it this way, but as your projects begin to
grow, it will make things much easier!
Going Further with Digital Output
If you know how to control one digital pin, you know how to control the rest.
Now try adding more LEDs to the mix.
For this exercise, you'll need:
• Breadboard (Makershed.com part number MKEL3, Adafruit.com part
number 64, Sparkfun.com part number 12002)
• Jumper wires (Makershed.com part number MKSEEED3, Adafruit.com
part number 758, Sparkfun.com part number 08431)
• LEDs (Makershed.com part number MKEE7, Adafruit.com part number
299, Sparkfun.com part number 12062)
• Resistors (Makershed.com part number MKEE4, Sparkfun.com part
number 10969)
Here's how to wire up more LEDs, step-by-step:
1. Connect Galileo's ground pin to the negative rail on your breadboard.
2. Insert a few LEDs between the ground rail and different rows on the
breadboard. Don't forget that the shorter lead (the cathode) connects
to ground while the longer lead (the anode) connects to the digital pin
through a resistor.
3. Connect each of those rows to different digital output pins through the
appropriate current limiting resistor. See figure Figure 3-10 .
Search WWH ::




Custom Search