led v3
Fork of LED by
LED.cpp@3:ca5c598be185, 2017-02-09 (annotated)
- Committer:
- fab16
- Date:
- Thu Feb 09 16:14:19 2017 +0000
- Revision:
- 3:ca5c598be185
- Parent:
- 2:d08b46f9050c
V3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Hygde | 0:1ccc5328ef67 | 1 | #include "mbed.h" |
Hygde | 0:1ccc5328ef67 | 2 | #include "LED.h" |
Hygde | 0:1ccc5328ef67 | 3 | |
Hygde | 0:1ccc5328ef67 | 4 | |
fab16 | 2:d08b46f9050c | 5 | DigitalOut myled1(LED1); |
fab16 | 2:d08b46f9050c | 6 | DigitalOut myled2(LED2); |
fab16 | 2:d08b46f9050c | 7 | DigitalOut myled3(LED3); |
fab16 | 2:d08b46f9050c | 8 | DigitalOut myled4(LED4); |
fab16 | 2:d08b46f9050c | 9 | |
fab16 | 2:d08b46f9050c | 10 | void LED::LED_Blinking(DigitalOut LED, float duree){ |
fab16 | 2:d08b46f9050c | 11 | LED = 1; |
fab16 | 2:d08b46f9050c | 12 | wait(duree); |
fab16 | 2:d08b46f9050c | 13 | LED = 0; |
fab16 | 2:d08b46f9050c | 14 | wait(duree); |
fab16 | 2:d08b46f9050c | 15 | } |
fab16 | 2:d08b46f9050c | 16 | |
fab16 | 2:d08b46f9050c | 17 | void LED::K1000(float duree){ |
fab16 | 2:d08b46f9050c | 18 | myled1=1; |
fab16 | 2:d08b46f9050c | 19 | myled2=1; |
fab16 | 2:d08b46f9050c | 20 | myled3=1; |
fab16 | 2:d08b46f9050c | 21 | myled4=1; |
fab16 | 2:d08b46f9050c | 22 | wait(duree); |
fab16 | 2:d08b46f9050c | 23 | myled1=0; |
fab16 | 2:d08b46f9050c | 24 | myled2=0; |
fab16 | 2:d08b46f9050c | 25 | myled3=0; |
fab16 | 2:d08b46f9050c | 26 | myled4=0; |
fab16 | 2:d08b46f9050c | 27 | wait(duree); |
fab16 | 2:d08b46f9050c | 28 | } |
fab16 | 2:d08b46f9050c | 29 | |
fab16 | 2:d08b46f9050c | 30 | void LED::K2000(float duree){ |
fab16 | 2:d08b46f9050c | 31 | LED_Blinking(myled1,duree); |
fab16 | 2:d08b46f9050c | 32 | LED_Blinking(myled2,duree); |
fab16 | 2:d08b46f9050c | 33 | LED_Blinking (myled3,duree); |
fab16 | 2:d08b46f9050c | 34 | LED_Blinking(myled4,duree); |
fab16 | 2:d08b46f9050c | 35 | LED_Blinking(myled3,duree); |
fab16 | 2:d08b46f9050c | 36 | LED_Blinking(myled2,duree); |
fab16 | 2:d08b46f9050c | 37 | LED_Blinking(myled1,duree); |
fab16 | 2:d08b46f9050c | 38 | } |
fab16 | 2:d08b46f9050c | 39 | |
fab16 | 2:d08b46f9050c | 40 | void LED::K3000(float duree){ |
fab16 | 2:d08b46f9050c | 41 | myled1 = 1; |
fab16 | 2:d08b46f9050c | 42 | wait(duree); |
fab16 | 2:d08b46f9050c | 43 | myled2 = 1; |
fab16 | 2:d08b46f9050c | 44 | wait(duree); |
fab16 | 2:d08b46f9050c | 45 | myled3 = 1; |
fab16 | 2:d08b46f9050c | 46 | wait(duree); |
fab16 | 2:d08b46f9050c | 47 | myled4 = 1; |
fab16 | 2:d08b46f9050c | 48 | wait(duree); |
fab16 | 2:d08b46f9050c | 49 | myled4 = 0; |
fab16 | 2:d08b46f9050c | 50 | wait(duree); |
fab16 | 2:d08b46f9050c | 51 | myled3 = 0; |
fab16 | 2:d08b46f9050c | 52 | wait(duree); |
fab16 | 2:d08b46f9050c | 53 | myled2 = 0; |
fab16 | 2:d08b46f9050c | 54 | wait(duree); |
fab16 | 2:d08b46f9050c | 55 | myled1 = 0; |
fab16 | 2:d08b46f9050c | 56 | wait(duree); |
fab16 | 2:d08b46f9050c | 57 | } |
fab16 | 2:d08b46f9050c | 58 | |
fab16 | 2:d08b46f9050c | 59 | void LED::K4000(float duree){ |
fab16 | 2:d08b46f9050c | 60 | myled4 = 1; |
fab16 | 2:d08b46f9050c | 61 | wait(duree); |
fab16 | 2:d08b46f9050c | 62 | myled3 = 1; |
fab16 | 2:d08b46f9050c | 63 | wait(duree); |
fab16 | 2:d08b46f9050c | 64 | myled2 = 1; |
fab16 | 2:d08b46f9050c | 65 | wait(duree); |
fab16 | 2:d08b46f9050c | 66 | myled1 = 1; |
fab16 | 2:d08b46f9050c | 67 | wait(duree); |
fab16 | 2:d08b46f9050c | 68 | myled1 = 0; |
fab16 | 2:d08b46f9050c | 69 | wait(duree); |
fab16 | 2:d08b46f9050c | 70 | myled2 = 0; |
fab16 | 2:d08b46f9050c | 71 | wait(duree); |
fab16 | 2:d08b46f9050c | 72 | myled3 = 0; |
fab16 | 2:d08b46f9050c | 73 | wait(duree); |
fab16 | 2:d08b46f9050c | 74 | myled4 = 0; |
fab16 | 3:ca5c598be185 | 75 | } |
fab16 | 3:ca5c598be185 | 76 | |
fab16 | 3:ca5c598be185 | 77 | void LED::LED_desynchrone(float duree){ |
fab16 | 3:ca5c598be185 | 78 | myled4 = 1; |
fab16 | 3:ca5c598be185 | 79 | myled1 = 1; |
fab16 | 3:ca5c598be185 | 80 | wait(duree); |
fab16 | 3:ca5c598be185 | 81 | myled4 = 0; |
fab16 | 3:ca5c598be185 | 82 | myled1 = 0; |
fab16 | 3:ca5c598be185 | 83 | wait(duree); |
fab16 | 3:ca5c598be185 | 84 | myled2 = 1; |
fab16 | 3:ca5c598be185 | 85 | myled3 = 1; |
fab16 | 3:ca5c598be185 | 86 | wait(duree); |
fab16 | 3:ca5c598be185 | 87 | myled2 = 0; |
fab16 | 3:ca5c598be185 | 88 | myled3 = 0; |
fab16 | 2:d08b46f9050c | 89 | } |