A demo program for DebounceIn

Dependencies:   DebounceIn mbed

Committer:
takuo
Date:
Sun Dec 20 12:05:24 2015 +0000
Revision:
0:3588368c5b3c
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takuo 0:3588368c5b3c 1 /** A demo program for DebounceIn
takuo 0:3588368c5b3c 2 * Takuo WATANABE
takuo 0:3588368c5b3c 3 * http://mbed.org/users/takuo/code/DebounceIn/
takuo 0:3588368c5b3c 4 */
takuo 0:3588368c5b3c 5
takuo 0:3588368c5b3c 6 #include "mbed.h"
takuo 0:3588368c5b3c 7 #include "DebounceIn.h"
takuo 0:3588368c5b3c 8
takuo 0:3588368c5b3c 9 int nrise = 0, nfall = 0;
takuo 0:3588368c5b3c 10 void rise() { nrise++; }
takuo 0:3588368c5b3c 11 void fall() { nfall++; }
takuo 0:3588368c5b3c 12
takuo 0:3588368c5b3c 13 int main() {
takuo 0:3588368c5b3c 14 DebounceIn button(p14);
takuo 0:3588368c5b3c 15 button.rise(rise);
takuo 0:3588368c5b3c 16 button.fall(fall);
takuo 0:3588368c5b3c 17 while (true) {
takuo 0:3588368c5b3c 18 printf("nrise=%d, nfall=%d\n", nrise, nfall);
takuo 0:3588368c5b3c 19 wait(1);
takuo 0:3588368c5b3c 20 }
takuo 0:3588368c5b3c 21 }