Data Sheet

-19-
Button
Project 6
Build this circuit. Load sketch Button into Snapino
T
M
using
the programming instructions in project 3. The red LED (D1)
should be on; push the press switch (S2) to turn it off.
Swap the locations of the press switch and 10KW resistor
(R4). Now the red LED turns on when the press switch is
pushed.
Programming Note:
This sketch monitors the voltage between the 10KW resistor and
press switch; normally the resistor pulls the voltage high, but
pushing the switch pulls it low. Snapino
TM
monitors the voltage and
turns off the red LED when it receives a low signal from the button.
If the button is released, then the monitored voltage will go back to
high, and Snapino
TM
turns on the red LED.
digitalRead(button) - this command tells Snapino
TM
to read the
voltage at button (which had been assigned as digital pin 9), and
assign it to variable buttonState.
SCSNAPINO_Manual_112816.qxp 12/30/16 2:00 PM Page 20