Data Sheet
Project 19
Sloppy Switches
Build the circuit and load sketch Sloppy Switches into Snapino
TM
using
the programming instructions in project 3. Slowly push the press switch
(S2) many times, watching the red LED (D1) as you do. Usually the
LED will turn on or off when you push the switch, but sometimes it will
stay the same. Do you know why the LED sometimes stays the same?
Programming Note:
When you push the switch
its contacts may bounce,
sometimes making
equipment monitoring the
switch think it was pressed
more than once. This
effect is called “switch
bounce”. To prevent this a
small delay is normally
added to ensure the
switch contacts have
settled before the sketch
checks the switch again.
In this sketch the
delay
(10); command has
// in front of it, making it a
comment that is ignored
by the sketch. Remove the
//, upload the revised
sketch, and see if the red
LED always changes
when you push the switch.
Project 20
Click Counter
This project opens a window on your
computer to display how many times
you pressed a button. Use the
preceding circuit but upload sketch
Click_Counter into Snapino
TM
. When
the upload is finished, click on the
Tools menu, then pick Serial Monitor
from the list. A window opens on your
computer screen. Push the press
switch (S2) as many times as you like;
the program displays the current count
on your computer screen. The red LED
(D1) is not used, and may be removed.
Programming Note:
Remove the delay(10);
command from the sketch
(or add // in front to make it
a comment that is ignored),
upload the revised sketch,
and watch the display as
you are pushing the press
switch. Notice that
sometimes the display will
show you pushed the
switch several times when
you only pushed it once.
-29-
SCSNAPINO_Manual_112816.qxp 12/30/16 2:00 PM Page 30










