Michio Ono
/
mbed_night_rider_LED_Array
Night Rider (LED Array)
main.cpp@0:111508c76839, 2014-07-12 (annotated)
- Committer:
- micono
- Date:
- Sat Jul 12 05:55:51 2014 +0000
- Revision:
- 0:111508c76839
Night Rider (LED Array)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
micono | 0:111508c76839 | 1 | #include "mbed.h" |
micono | 0:111508c76839 | 2 | |
micono | 0:111508c76839 | 3 | DigitalOut myled[]={LED1,LED2,LED3,LED4}; |
micono | 0:111508c76839 | 4 | /*DigitalOut myled1(LED1); |
micono | 0:111508c76839 | 5 | DigitalOut myled2(LED2); |
micono | 0:111508c76839 | 6 | DigitalOut myled3(LED3); |
micono | 0:111508c76839 | 7 | DigitalOut myled4(LED4); |
micono | 0:111508c76839 | 8 | */ |
micono | 0:111508c76839 | 9 | |
micono | 0:111508c76839 | 10 | int main() { |
micono | 0:111508c76839 | 11 | while(1) { |
micono | 0:111508c76839 | 12 | for(int i=0;i<4;i++) { |
micono | 0:111508c76839 | 13 | myled[i]=1; |
micono | 0:111508c76839 | 14 | wait(0.1); |
micono | 0:111508c76839 | 15 | myled[i]=0; |
micono | 0:111508c76839 | 16 | } |
micono | 0:111508c76839 | 17 | for(int i=2;i>0;i--) { |
micono | 0:111508c76839 | 18 | myled[i]=1; |
micono | 0:111508c76839 | 19 | wait(0.1); |
micono | 0:111508c76839 | 20 | myled[i]=0; |
micono | 0:111508c76839 | 21 | } |
micono | 0:111508c76839 | 22 | |
micono | 0:111508c76839 | 23 | /* |
micono | 0:111508c76839 | 24 | myled1 = 1; |
micono | 0:111508c76839 | 25 | wait(0.05); |
micono | 0:111508c76839 | 26 | myled1 = 0; |
micono | 0:111508c76839 | 27 | wait(0.05); |
micono | 0:111508c76839 | 28 | myled2 = 1; |
micono | 0:111508c76839 | 29 | wait(0.05); |
micono | 0:111508c76839 | 30 | myled2 = 0; |
micono | 0:111508c76839 | 31 | wait(0.05); |
micono | 0:111508c76839 | 32 | myled3 = 1; |
micono | 0:111508c76839 | 33 | wait(0.05); |
micono | 0:111508c76839 | 34 | myled3 = 0; |
micono | 0:111508c76839 | 35 | wait(0.05); |
micono | 0:111508c76839 | 36 | myled4 = 1; |
micono | 0:111508c76839 | 37 | wait(0.05); |
micono | 0:111508c76839 | 38 | myled4 = 0; |
micono | 0:111508c76839 | 39 | wait(0.05); |
micono | 0:111508c76839 | 40 | |
micono | 0:111508c76839 | 41 | myled3 = 1; |
micono | 0:111508c76839 | 42 | wait(0.05); |
micono | 0:111508c76839 | 43 | myled3 = 0; |
micono | 0:111508c76839 | 44 | wait(0.05); |
micono | 0:111508c76839 | 45 | myled2 = 1; |
micono | 0:111508c76839 | 46 | wait(0.05); |
micono | 0:111508c76839 | 47 | myled2 = 0; |
micono | 0:111508c76839 | 48 | wait(0.05); |
micono | 0:111508c76839 | 49 | */ |
micono | 0:111508c76839 | 50 | |
micono | 0:111508c76839 | 51 | } |
micono | 0:111508c76839 | 52 | } |