Hardware Reference
In-Depth Information
You've now got a nice clean signal that you can feed into your hardware
interrupt function!
Assembling the Complete Test Circuit
From a schematic level, you now understand how to wire up a button debouncer.
For the tests that you'll run momentarily, you use an RGB LED in tandem with
a button to test your hardware-debouncing and interrupt code. Wire up a com-
plete circuit as shown in the wiring diagram in FigureĀ 12-8.
Figure 12-8: Complete hardware interrupt wiring diagram
Writing the Software
It's now time to write a simple program to test both your debouncing and the
hardware interrupt capabilities of the Arduino. The most obvious and useful
implementation of hardware interrupts on the Arduino is to allow you to listen
for external inputs even while running timed operations that use delay() . There
are many scenarios where this might happen, but a simple one occurs when
fading an LED using pulse-width modulation (PWM) via analogWrite() . In
this sketch, you have one of the three RGB LEDs always fading up and down
Search WWH ::




Custom Search