Robin Handy
/
mbed_dreiled
last version
https://os.mbed.com/teams/ABELI2019/code/Robin-Handy/
main.cpp@0:c28a0d145b92, 2019-12-06 (annotated)
- Committer:
- rob117
- Date:
- Fri Dec 06 14:49:43 2019 +0000
- Revision:
- 0:c28a0d145b92
dreileds
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rob117 | 0:c28a0d145b92 | 1 | #include "mbed.h" |
rob117 | 0:c28a0d145b92 | 2 | |
rob117 | 0:c28a0d145b92 | 3 | DigitalOut led1(LED1); |
rob117 | 0:c28a0d145b92 | 4 | DigitalOut led2(LED2); |
rob117 | 0:c28a0d145b92 | 5 | DigitalOut led3(LED3); |
rob117 | 0:c28a0d145b92 | 6 | |
rob117 | 0:c28a0d145b92 | 7 | |
rob117 | 0:c28a0d145b92 | 8 | int main() { |
rob117 | 0:c28a0d145b92 | 9 | while (1) { |
rob117 | 0:c28a0d145b92 | 10 | |
rob117 | 0:c28a0d145b92 | 11 | led1 = !led1; |
rob117 | 0:c28a0d145b92 | 12 | wait_ms(20); //100 Hz |
rob117 | 0:c28a0d145b92 | 13 | |
rob117 | 0:c28a0d145b92 | 14 | if (led1==0){ |
rob117 | 0:c28a0d145b92 | 15 | |
rob117 | 0:c28a0d145b92 | 16 | led2 = !led2; |
rob117 | 0:c28a0d145b92 | 17 | wait_ms(10); //50 Hz |
rob117 | 0:c28a0d145b92 | 18 | |
rob117 | 0:c28a0d145b92 | 19 | |
rob117 | 0:c28a0d145b92 | 20 | |
rob117 | 0:c28a0d145b92 | 21 | |
rob117 | 0:c28a0d145b92 | 22 | } |
rob117 | 0:c28a0d145b92 | 23 | |
rob117 | 0:c28a0d145b92 | 24 | if((led1 == 1) && (led2 == 1)) //Wenn led1 und led2 leuchtet soll led3 leuchten |
rob117 | 0:c28a0d145b92 | 25 | { |
rob117 | 0:c28a0d145b92 | 26 | led3= !led3; |
rob117 | 0:c28a0d145b92 | 27 | } |
rob117 | 0:c28a0d145b92 | 28 | |
rob117 | 0:c28a0d145b92 | 29 | |
rob117 | 0:c28a0d145b92 | 30 | |
rob117 | 0:c28a0d145b92 | 31 | } |
rob117 | 0:c28a0d145b92 | 32 | |
rob117 | 0:c28a0d145b92 | 33 | |
rob117 | 0:c28a0d145b92 | 34 | |
rob117 | 0:c28a0d145b92 | 35 | } |