Grove Starter Kit for mbed - Button

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lingtien5846
Date:
Mon Feb 16 10:59:24 2015 +0000
Child:
1:f93ac9d8770c
Commit message:
Grove Starter Kit for mbed - Button

Changed in this revision

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 16 10:59:24 2015 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+DigitalIn button(p21);
+
+int main() {
+    while(1) {
+        if (button) {
+            myled = 1;
+        }
+        else
+            myled = 0;
+            
+        wait(0.7); // simple debouncing
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 16 10:59:24 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file