beautypg.com

Project b8 bounceless switches – Elenco XP&trade User Manual

Page 42

background image

-41-

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 1k

Ω

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.

Project B8

Bounceless Switches

Optional:

The “switch bounce” problem
was fixed here by adding a
0.1 second pause before the
microcontroller checks if the
switch was pressed.

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).