This class carries out software debouncing of Digitial in, and provides some method to look at details such as how many debounced rising and falling there have been, and how long the input has been in its current stable state.

Dependencies:   mbed

Committer:
chris
Date:
Fri Nov 27 16:05:32 2009 +0000
Revision:
0:672241227e0d

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:672241227e0d 1 #include "mbed.h"
chris 0:672241227e0d 2 #include "DebouncedIn.h"
chris 0:672241227e0d 3
chris 0:672241227e0d 4
chris 0:672241227e0d 5 DigitalOut led(LED1);
chris 0:672241227e0d 6 DebouncedIn button(p21);
chris 0:672241227e0d 7
chris 0:672241227e0d 8 int main() {
chris 0:672241227e0d 9
chris 0:672241227e0d 10 while(1) {
chris 0:672241227e0d 11 if (button.rising()) {
chris 0:672241227e0d 12 led = !led;
chris 0:672241227e0d 13 }
chris 0:672241227e0d 14 }
chris 0:672241227e0d 15
chris 0:672241227e0d 16 }