wang tang
/
LED3
LED and button system3
Fork of LED2 by
main.cpp@0:6e75cf3220cb, 2017-10-19 (annotated)
- Committer:
- rozendhyan
- Date:
- Thu Oct 19 12:36:02 2017 +0000
- Revision:
- 0:6e75cf3220cb
- Child:
- 1:59cafc988b1c
Testing on board;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rozendhyan | 0:6e75cf3220cb | 1 | #include "mbed.h" |
rozendhyan | 0:6e75cf3220cb | 2 | |
rozendhyan | 0:6e75cf3220cb | 3 | DigitalOut led1(D4); |
rozendhyan | 0:6e75cf3220cb | 4 | DigitalOut led2(D5); |
rozendhyan | 0:6e75cf3220cb | 5 | DigitalOut led3(D6); |
rozendhyan | 0:6e75cf3220cb | 6 | void LED_Blinkly(DigitalOut led1,DigitalOut led2,DigitalOut led3); |
rozendhyan | 0:6e75cf3220cb | 7 | // main() runs in its own thread in the OS |
rozendhyan | 0:6e75cf3220cb | 8 | int main() { |
rozendhyan | 0:6e75cf3220cb | 9 | LED_Blinkly(led1, led2, led3); |
rozendhyan | 0:6e75cf3220cb | 10 | } |
rozendhyan | 0:6e75cf3220cb | 11 | void LED_Blinkly(DigitalOut led1,DigitalOut led2,DigitalOut led3){ |
rozendhyan | 0:6e75cf3220cb | 12 | while(true){ |
rozendhyan | 0:6e75cf3220cb | 13 | led1 =! led1; |
rozendhyan | 0:6e75cf3220cb | 14 | wait(0.5); |
rozendhyan | 0:6e75cf3220cb | 15 | led2 =! led2; |
rozendhyan | 0:6e75cf3220cb | 16 | wait(0.5); |
rozendhyan | 0:6e75cf3220cb | 17 | led3 =! led3; |
rozendhyan | 0:6e75cf3220cb | 18 | wait(0.5); |
rozendhyan | 0:6e75cf3220cb | 19 | } |
rozendhyan | 0:6e75cf3220cb | 20 | } |
rozendhyan | 0:6e75cf3220cb | 21 |