跑马灯4个

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
denghua1984726
Date:
Fri Apr 25 02:34:26 2014 +0000
Parent:
1:03c191369089
Commit message:
???4?

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Jan 01 20:57:57 2012 +0000
+++ b/main.cpp	Fri Apr 25 02:34:26 2014 +0000
@@ -1,12 +1,28 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
 
 int main() {
+    myled1 = 0;
+    myled2 = 0;
+    myled3 = 0;
+    myled4 = 0;
+    
     while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+        myled4 = 0;
+        myled1 = 1;
+        wait(0.5);
+        myled1 = 0;
+        myled2 = 1;
+        wait(0.5);
+        myled2 = 0;
+        myled3 = 1;
+        wait(0.5);
+        myled3 = 0;
+        myled4 = 1;
+        wait(0.5);
     }
 }