A demo program for DebounceIn

Dependencies:   DebounceIn mbed

Files at this revision

API Documentation at this revision

Comitter:
takuo
Date:
Sun Dec 20 12:05:24 2015 +0000
Commit message:
Initial commit

Changed in this revision

DebounceIn.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 3588368c5b3c DebounceIn.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DebounceIn.lib	Sun Dec 20 12:05:24 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/takuo/code/DebounceIn/#e43521d55082
diff -r 000000000000 -r 3588368c5b3c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Dec 20 12:05:24 2015 +0000
@@ -0,0 +1,21 @@
+/** A demo program for DebounceIn
+ * Takuo WATANABE
+ * http://mbed.org/users/takuo/code/DebounceIn/
+ */
+
+#include "mbed.h"
+#include "DebounceIn.h"
+
+int nrise = 0, nfall = 0;
+void rise() { nrise++; }
+void fall() { nfall++; }
+
+int main() {
+    DebounceIn button(p14);
+    button.rise(rise);
+    button.fall(fall);
+    while (true) {
+        printf("nrise=%d, nfall=%d\n", nrise, nfall);
+        wait(1);
+    }
+}
diff -r 000000000000 -r 3588368c5b3c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Dec 20 12:05:24 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file