The Arduino Inventor's Guide

The Arduino Inventor's Guide by Unknown Page A

Book: The Arduino Inventor's Guide by Unknown Read Free Book Online
Authors: Unknown
Ads: Link
seven individual segments and the decimal point with a corresponding wiring diagram

    You can control one of these displays the same way you control the Nine-Pixel Animation Machine: just create custom functions for each number. For a challenge, create a single function that lets you pass a number to display to it.

4 Reaction Timer
    An average human reacts to a visual stimulus , like a light turning on, in about 215 milliseconds. This is the time it takes for a signal you see with your eyes to travel to your brain and out to your limbs to respond. The reaction timer is a great project to demonstrate this time delay, and it also makes for a fun game! How fast are you and your friends?
    In this chapter, you’ll learn how to build your own reaction timer using Arduino. The full project is shown in Figure 4-1 . The concept behind it is simple: the Arduino will turn on an LED, start a timer, and wait until you press a button. When you see the LED turn on, you press the button as quickly as you can, and the Arduino will report back to your computer the time between the light coming on and you pressing the button. The Arduino has a 16 MHz clock, which means that it can process 16 million instructions per second! That’s
fast
, and it makes the Arduino perfect for this project.
    FIGURE 4-1: The completed Reaction Timer project

MATERIALS TO GATHER
    Like the previous projects in this book, the Reaction Timer uses LEDs, resistors, wires, and an Arduino. Unlike other projects, this one also includes a button to make the game interactive, and to make it look spiffy we suggest a custom cardboard enclosure. Figures 4-2 and 4-3 show the parts and materials you’ll need for 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)
    • One solderless breadboard (PRT-12002)
    • One red LED, one blue LED, and one green LED (COM-12062)
    • Three 330 Ω resistors (COM-08377, or COM-11507 for a pack of 20)
    • One 10 kΩ resistor (COM-08374, or COM-11508 for a pack of 20)
    • One push button (COM-10302)
    • Male-to-male jumper wires (PRT-11026)
    • Male-to-female jumper wires (PRT-09140*)
    NOTE
    The parts marked with an asterisk (*) do not come with the standard SparkFun Inventor’s Kit but are available in the separate add-on kit.
    FIGURE 4-2: Components and materials for the Reaction Timer

Other Materials and Tools
    • Pencil
    • Craft knife
    • Metal ruler
    • Glue (hot glue gun or craft glue)
    • (Optional) Drill and 3/16-inch and 5/16-inch drill bits
    • (Optional) Wire cutters (not shown)
    • Cardboard (about 12 inches square) or a cardboard box
    • Enclosure template (see Figure 4-16 on page 115 )
    • (Optional) Ping-pong ball
    FIGURE 4-3: Recommended tools

NEW COMPONENT: THE PUSH BUTTON
    This project revolves around two components: an LED and a button. The button switch is an
input
to an Arduino pin, which means that the sketch can react to a change in the voltage on that pin. Inputs like buttons let you create circuits that people can interact with.
How Push Buttons Work
    There are many different kinds of push buttons, but they all work in a similar manner. A
push button
is really an electrical switch. Push buttons like the ones in Figure 4-4 are small, spring-loaded devices that connect two sides together electrically for as long as you apply pressure, like the keys on your keyboard. And they’re everywhere—in remote controls, garage door openers, coffee makers, radios, game controllers, and so much more!
    FIGURE 4-4: A variety of push buttons

    These nifty input devices are really simple on the inside. Figure 4-5 shows the schematics for both a push button and a switch.
    FIGURE 4-5: Schematic drawings for a push button and a switch

    When you flip a switch on, a piece of metal inside closes the gap between two contacts, like a gate. When you press a push button, metal

Similar Books

Mad Cows

Kathy Lette

Inside a Silver Box

Walter Mosley

Irresistible Impulse

Robert K. Tanenbaum

Bat-Wing

Sax Rohmer

Two from Galilee

Marjorie Holmes