Project B8
Use the same circuit as project B7. Load the program
Bounceless Switches into the microcontroller (U21)
using the programming instructions in project B1. The
circuit works the same, except the LED will toggle every
time the switch is pressed. The "switch bounce" problem
has been fixed.
Part B. Try swapping the positions of the press switch
(S2) and the 1kW resistor (R2). Now the red LED
changes when the press switch is released instead of
when the switch is pushed.
Sometimes hardware cannot be changed but the
software (program) can. How could you change the
flowchart program to make the LED toggle when the
press switch is released using the original circuit?
Snappy knows how.
-41-
Bounceless Switches
Optional:
To make the LED toggle
when the press switch is
released, change the input
pin 3 tests (from 1 to 0 or
from 0 to 1).
The "switch bounce" problem
was fixed here by adding a
0.1 second pause before the
microcontroller checks if the
switch was pressed.