Takuo WATANABE / Mbed 2 deprecated DebounceIn_Demo

Dependencies:   DebounceIn mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /** A demo program for DebounceIn
00002  * Takuo WATANABE
00003  * http://mbed.org/users/takuo/code/DebounceIn/
00004  */
00005 
00006 #include "mbed.h"
00007 #include "DebounceIn.h"
00008 
00009 int nrise = 0, nfall = 0;
00010 void rise() { nrise++; }
00011 void fall() { nfall++; }
00012 
00013 int main() {
00014     DebounceIn button(p14);
00015     button.rise(rise);
00016     button.fall(fall);
00017     while (true) {
00018         printf("nrise=%d, nfall=%d\n", nrise, nfall);
00019         wait(1);
00020     }
00021 }