![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
My 1st Basic program - Knight Rider running LEDs. Please comments.Thanks
main.cpp@0:0a1f0ff882c9, 2011-03-13 (annotated)
- Committer:
- charles77
- Date:
- Sun Mar 13 07:58:18 2011 +0000
- Revision:
- 0:0a1f0ff882c9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
charles77 | 0:0a1f0ff882c9 | 1 | #include "mbed.h" |
charles77 | 0:0a1f0ff882c9 | 2 | |
charles77 | 0:0a1f0ff882c9 | 3 | DigitalOut myled1(LED1); |
charles77 | 0:0a1f0ff882c9 | 4 | DigitalOut myled2(LED2); |
charles77 | 0:0a1f0ff882c9 | 5 | DigitalOut myled3(LED3); |
charles77 | 0:0a1f0ff882c9 | 6 | DigitalOut myled4(LED4); |
charles77 | 0:0a1f0ff882c9 | 7 | |
charles77 | 0:0a1f0ff882c9 | 8 | int main() { |
charles77 | 0:0a1f0ff882c9 | 9 | while(1) { |
charles77 | 0:0a1f0ff882c9 | 10 | myled1 = 1; |
charles77 | 0:0a1f0ff882c9 | 11 | wait(0.1); |
charles77 | 0:0a1f0ff882c9 | 12 | myled2 = 1; |
charles77 | 0:0a1f0ff882c9 | 13 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 14 | myled3 = 1; |
charles77 | 0:0a1f0ff882c9 | 15 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 16 | myled4 = 1; |
charles77 | 0:0a1f0ff882c9 | 17 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 18 | myled1 = 0; |
charles77 | 0:0a1f0ff882c9 | 19 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 20 | myled2 = 0; |
charles77 | 0:0a1f0ff882c9 | 21 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 22 | myled3 = 0; |
charles77 | 0:0a1f0ff882c9 | 23 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 24 | myled4 = 0; |
charles77 | 0:0a1f0ff882c9 | 25 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 26 | myled4 = 1; |
charles77 | 0:0a1f0ff882c9 | 27 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 28 | myled3 = 1; |
charles77 | 0:0a1f0ff882c9 | 29 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 30 | myled2 = 1; |
charles77 | 0:0a1f0ff882c9 | 31 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 32 | myled1 = 1; |
charles77 | 0:0a1f0ff882c9 | 33 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 34 | myled4 = 0; |
charles77 | 0:0a1f0ff882c9 | 35 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 36 | myled3 = 0; |
charles77 | 0:0a1f0ff882c9 | 37 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 38 | myled2 = 0; |
charles77 | 0:0a1f0ff882c9 | 39 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 40 | myled1 = 0; |
charles77 | 0:0a1f0ff882c9 | 41 | wait (0.1); |
charles77 | 0:0a1f0ff882c9 | 42 | |
charles77 | 0:0a1f0ff882c9 | 43 | } |
charles77 | 0:0a1f0ff882c9 | 44 | } |