led v3

Dependents:   robot_final

Fork of LED by Projet robot

Revision:
0:1ccc5328ef67
diff -r 000000000000 -r 1ccc5328ef67 LED.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LED.c	Thu Jan 26 13:28:39 2017 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "LED.h"
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+void LED_Blinking(DigitalOut LED, float duree){
+    LED = 1;
+    wait(duree);
+    LED = 0;
+    wait(duree);
+}
+
+void K2000(float duree){
+    LED_Blinking(myled1,duree);
+    LED_Blinking(myled2,duree);
+    LED_Blinking(myled3,duree);
+    LED_Blinking(myled4,duree);
+    LED_Blinking(myled3,duree);
+    LED_Blinking(myled2,duree);
+    LED_Blinking(myled1,duree);
+}
+
+void K3000(float duree){
+    myled1 = 1;
+    wait(duree);
+    myled2 = 1;
+    wait(duree);
+    myled3 = 1;
+    wait(duree);
+    myled4 = 1;
+    wait(duree);
+    myled4 = 0;
+    wait(duree);
+    myled3 = 0;
+    wait(duree);
+    myled2 = 0;
+    wait(duree);
+    myled1 = 0;
+    wait(duree);
+}
+
+void K4000(float duree){
+    myled4 = 1;
+    wait(duree);
+    myled3 = 1;
+    wait(duree);
+    myled2 = 1;
+    wait(duree);
+    myled1 = 1;
+    wait(duree);
+    myled1 = 0;
+    wait(duree);
+    myled2 = 0;
+    wait(duree);
+    myled3 = 0;
+    wait(duree);
+    myled4 = 0;
+}
\ No newline at end of file