通过按键控制LED

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Andthen
Date:
Sat Dec 05 03:27:57 2015 +0000
Commit message:
mbed???????

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	Sat Dec 05 03:27:57 2015 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+DigitalOut led1(LED1);
+DigitalIn btn(USER_BUTTON);
+int main()
+{
+    led1=0;
+    while (1) {
+        if (btn==0 ) {
+            wait_ms(10);
+            if (btn==0 ) {
+                led1=!led1;
+                while (btn==0);
+            }
+        }
+
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 05 03:27:57 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b
\ No newline at end of file