![](/media/cache/profiles/IvyS.JPG.50x50_q85.jpg)
My version of Blinkly
main.cpp@0:7b5a4e4c4484, 2018-02-01 (annotated)
- Committer:
- Ivone
- Date:
- Thu Feb 01 17:42:42 2018 +0000
- Revision:
- 0:7b5a4e4c4484
Lab 1 Blinkly
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ivone | 0:7b5a4e4c4484 | 1 | #include "mbed.h" |
Ivone | 0:7b5a4e4c4484 | 2 | #include "rtos.h" |
Ivone | 0:7b5a4e4c4484 | 3 | |
Ivone | 0:7b5a4e4c4484 | 4 | DigitalOut myled(LED1); |
Ivone | 0:7b5a4e4c4484 | 5 | DigitalOut myled2 (LED2); |
Ivone | 0:7b5a4e4c4484 | 6 | DigitalOut myled3 (LED3); |
Ivone | 0:7b5a4e4c4484 | 7 | |
Ivone | 0:7b5a4e4c4484 | 8 | int main() { |
Ivone | 0:7b5a4e4c4484 | 9 | int state = 1; |
Ivone | 0:7b5a4e4c4484 | 10 | while (1) { |
Ivone | 0:7b5a4e4c4484 | 11 | Thread::wait(300); |
Ivone | 0:7b5a4e4c4484 | 12 | switch (state){ |
Ivone | 0:7b5a4e4c4484 | 13 | case 0 : |
Ivone | 0:7b5a4e4c4484 | 14 | myled =1 ; |
Ivone | 0:7b5a4e4c4484 | 15 | myled2 =1; |
Ivone | 0:7b5a4e4c4484 | 16 | myled3 =0; |
Ivone | 0:7b5a4e4c4484 | 17 | state =1 ; |
Ivone | 0:7b5a4e4c4484 | 18 | break ; |
Ivone | 0:7b5a4e4c4484 | 19 | case 1 : |
Ivone | 0:7b5a4e4c4484 | 20 | myled =0; |
Ivone | 0:7b5a4e4c4484 | 21 | myled2 =1; |
Ivone | 0:7b5a4e4c4484 | 22 | myled3 =1; |
Ivone | 0:7b5a4e4c4484 | 23 | state =0; |
Ivone | 0:7b5a4e4c4484 | 24 | break; |
Ivone | 0:7b5a4e4c4484 | 25 | } |
Ivone | 0:7b5a4e4c4484 | 26 | } |
Ivone | 0:7b5a4e4c4484 | 27 | } |