connection, so the circuit is broken and the LED does not
light up. When you press the button, the LED will light up.
; Is the LED on or off?
; Press the button and see if the LED comes on and stays
on while the button is pressed.
Take a moment to think about how the pins on the
breadboard are connected by the pushbutton when it is
open (unpressed) and closed (pressed). Figures 8 and 9
show these two states
Turn the LED off with a pushbutton – analog.
Let’s rebuild the circuit so that the LED is normally on,
and goes off only if the button is pushed. Note from the
schematic in Figure 10 that the current will flow from 5V
through the resistor and the LED to ground, but in Figure
11 the current will flow from 5V through the switch to
ground. The reason it flows through the switch and not
the LED is that the switch has near zero resistance, while
the LED has a relatively higher resistance. Current (like
water) flows down the path of least resistance.
Check off when complete:
; Make sure the power is off before building the circuit.
; Build the circuit as shown in Figure 10.
; Apply power to the circuit.
; Is the LED on or off when the button is not pushed?
; Push the button to verify that the LED turns off while
the button remains pushed as shown in Figure 11.
; Briefly explain why the LED is on when the button is
not pressed, and why it turns off when the button is
Lab 2: Reading a Pushbutton —
When an Arduino pin is set to
the input mode, it may be used to
determine if the pin is exposed to a
higher or lower voltage. In the design
shown in Figure 12, pin 12 is
connected to a 10 KW resistor that is
connected to ground. The pin is also
connected to a pushbutton that is
connected to five volts.
When the button is not pushed,
the pin is exposed to zero volts and
the Arduino software will read this as
a LOW. If the button is pushed, then
the pin is connected to both the 10
KW resistor to ground and to the five
Now, the pin detects that the
current is running from the five volts
April 2014 61
; FIGURE 10: Pushbutton LED normally on analog circuit.
; FIGURE 11: Pushbutton LED normally on
analog circuit — button pushed.
; FIGURE 12: Pushbutton to digital pin 12.