software to indicate that a button is
pushed or not pushed, and use that
information to control actions of your
system.
[ASIDE: There are many other terms
we may see that express the concept of
what a pin reads. Where we say that the
pin state is HIGH or LOW, others may
say TRUE or FALSE, 1 or 0, or Vcc or
GND. We are referring both to an analog
concept for the voltage on the pin and a
What is a Pushbutton?
There are many kinds of
pushbuttons, but all serve the same
purpose: to let a user connect or break
an electrical circuit. Our pushbuttons are
designed to break the circuit unless they
are pressed, and to make the connection
only when pressed. There are other
buttons that are designed to keep the
circuit connected unless pushed, and
then to break it while pushed. Another
type will toggle between connecting and
unconnecting the circuit on each press.
How does a pushbutton work?
In Chapter 2, we learned that a
circuit is simply the complete path of a
circle of conductors through which
electricity can flow. If you break the path
of the circle by cutting one of the
conductors, the electricity will no longer
flow.
Figure 1 shows a circuit with a nine
volt battery, a resistor, an LED, and a
pushbutton. The pushbutton is open so
that no current flows and the LED is not
lit. Figure 2 shows the same circuit with
the pushbutton pressed, making the
connection and allowing current to flow
and light up the LED.
The Arduino Pushbutton
Figures 1 and 2 show how a pushbutton works. Our pushbutton is a
little different. Instead of having one connection on each side of the
switch, it has two connections on each side as shown in Figure 3.
This can be a little confusing. In Figure 4, there’s a pushbutton on
our Arduino proto shield with the connections highlighted in yellow and
purple. As you can see, the left side of the pushbutton connects (shown
in yellow) both the top and bottom five-pin columns, and the right side
shown in purple connects those upper and lower rows.
April 2014 59
; FIGURE 1: Pushbutton open
circuit — no current.
; FIGURE 2: Pushbutton closed
circuit — current flows.
; FIGURE 3: Pushbutton
breadboard and
schematic symbols.
; FIGURE 4: Connections when not pushed.