Pulse with LED

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Eduvance
Date:
Tue May 27 07:26:31 2014 +0000
Parent:
0:4bffa357d089
Commit message:
A

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4bffa357d089 -r 7f83116d4810 main.cpp
--- a/main.cpp	Mon May 19 10:22:12 2014 +0000
+++ b/main.cpp	Tue May 27 07:26:31 2014 +0000
@@ -1,12 +1,52 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+DigitalIn psw0(p14);
+DigitalIn psw1(p15);
+DigitalIn psw2(p16);
+DigitalIn psw3(p17);
 
-int main() {
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+int main() 
+{
     while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
+        if(psw0==1 && psw1==0 && psw2==0 && psw3==0)
+        {
+        myled1 = 1;
+        myled2 = 1;
+        myled3 = 1;
+        myled4 = 1;
+        wait(0.4);
+        }
+
+        if(psw0==0 && psw1==1 && psw2==0 && psw3==0)
+        {
+        myled1=0;
+        myled2=0;
+        myled3=0;
+        myled4=0; 
+        wait(0.4);   
+        }
+        
+        if(psw0==0 && psw1==0 && psw2==1 && psw3==0)
+        {
+        myled1=1;
+        myled2=0;
+        myled3=1;
+        myled4=0; 
+        wait(0.4);   
+        }
+
+        if(psw0==0 && psw1==0 && psw2==0 && psw3==1)
+        {
+        myled1=0;
+        myled2=1;
+        myled3=0;
+        myled4=1; 
+        wait(0.4);   
+        }
 }
+}
\ No newline at end of file