led v3
Fork of LED by
Diff: LED.cpp
- Revision:
- 2:d08b46f9050c
- Parent:
- 1:4513264e463e
- Child:
- 3:ca5c598be185
--- a/LED.cpp Thu Jan 26 15:59:15 2017 +0000 +++ b/LED.cpp Thu Feb 09 14:35:40 2017 +0000 @@ -1,74 +1,75 @@ #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 K1000(float duree){ - myled1=1; - myled2=1; - myled3=1; - myled4=1; - wait(duree); - myled1=0; - myled2=0; - myled3=0; - myled4=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 + DigitalOut myled1(LED1); + DigitalOut myled2(LED2); + DigitalOut myled3(LED3); + DigitalOut myled4(LED4); + + void LED::LED_Blinking(DigitalOut LED, float duree){ + LED = 1; + wait(duree); + LED = 0; + wait(duree); + } + + void LED::K1000(float duree){ + myled1=1; + myled2=1; + myled3=1; + myled4=1; + wait(duree); + myled1=0; + myled2=0; + myled3=0; + myled4=0; + wait(duree); + } + + void LED::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 LED::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 LED::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