The Arduino Inventor's Guide

The Arduino Inventor's Guide by Unknown Read Free Book Online Page B

Book: The Arduino Inventor's Guide by Unknown Read Free Book Online
Authors: Unknown
bling. You could solder the LED legs to some wire to make the connections longer so it’s easy to hide the Arduino somewhere more comfortable for the wearer (like in a pocket). We took a Halloween spider we got from the local grocery store and hacked it with some creepy red eyes that blink (see Figure 1-23 ).
    Another good fit for blinking and controlling LEDs is in scale modeling. Adding working LEDs to car headlights, buildings, or streetlights is always a great way to create the illusion of reality in any scale model or scene, as shown in Figure 1-24 .
    FIGURE 1-23: A blinky scary spider

    FIGURE 1-24: A scale model with Arduino-controlled lights

SAVING YOUR SKETCH
    Every project looks more stylish with a few blinking LEDs, so we suggest you keep your remixed Blink sketch handy so you can reuse parts of it in future builds. Save your sketch, and be sure to name it something descriptive that’ll remind you what it is. Your filename should not contain any spaces; if it does, Arduino will replace the spaces with underscore (_) characters. By default, when you save your sketches, Arduino will save them to the Arduino sketchbook folder, usually found in the
Documents
folder on your computer. You can choose to save them elsewhere, but it’s often a good idea to have all your sketches in one place.
    When you’re ready to level up your blinking skills, head to Project 2 , where we’ll show you how to build your very own Arduino-powered stoplight.

2 A Stoplight for Your House
    In your first big step toward world domination through embedded electronics, you set up the Arduino IDE and blinked an LED. That’s huge, but with an Arduino, no project needs to stop at just one LED. This project will show you how to expand your first LED sketch to displaya blinking pattern on
three
LEDs. Your mission, should you choose to accept it, is to build and program a stoplight for a busy hallway in your house (see Figure 2-1 ).
    FIGURE 2-1: The completed Stoplight project

MATERIALS TO GATHER
    The materials in this project are all pretty simple. All of the electronic parts are standard in the SparkFun Inventor’s Kit, except for the ones marked with an asterisk (*). If you’re using your own kit or piecing together parts yourself, see the following parts list. Figure 2-2 shows all of the parts used in this project.
Electronic Parts
    • One SparkFun RedBoard (DEV-13975), Arduino Uno (DEV-11021), or any other Arduino-compatible board
    • One USB Mini-B cable (CAB-11301 or your board’s USB cable; not shown)
    • One solderless breadboard (PRT-12002)
    • One red LED, one yellow LED, and one green LED (COM-12062)
    • Three 330 Ω resistors (COM-08377, or COM-11507 for a pack of 20)
    • Male-to-male jumper wires (PRT-11026)
    • Male-to-female jumper wires (PRT-09140*)
    • (Optional) One 4 AA battery holder (PRT-09835*; not shown)
    FIGURE 2-2: Components for the Stoplight

Other Materials and Tools
    If you want to build an enclosure like the one in Figure 2-1 or follow the suggestions in “ Going Further ” on page 64 , you’ll also need the following supplies, shown in Figures 2-3 and 2-4 :
    • Pencil
    • Craft knife
    • Metal ruler
    • Pliers
    • Wire stripper
    • Glue (hot glue gun or craft glue)
    • (Optional) Drill and a 3/16-inch drill bit
    • (Optional) Soldering iron
    • (Optional) Solder
    • (Optional) Helping hands (not shown)
    • Cardboard (about 12 inches square) or a cardboard box
    • Two ping-pong balls
    • Enclosure template (see Figure 2-15 on page 55 )
    NOTE
    Good, clean cardboard will be worth its weight in gold in these projects. We suggest picking up cardboard sheets from a craft or art supply store.
    FIGURE 2-3: Recommended tools

    FIGURE 2-4: Recommended building materials

NEW COMPONENT: THE RESISTOR
    Although you used an LED on its own in Project 1 , in most cases it’s best to use a
resistor
to protect the LED from too much current. Resistors like the ones in Figure 2-5 are everywhere. They are

Similar Books

The Time Trap

Henry Kuttner

The Tin Man

Dale Brown

An Exchange of Hostages

Susan R. Matthews

Middle Age

Joyce Carol Oates

Until Tuesday

Bret Witter, Luis Carlos Montalván

The Immortal Highlander

Karen Marie Moning

Summer People

Aaron Stander