Leds1
Dependencies: mbed
main.cpp@0:ba1bd1c2656f, 2014-12-04 (annotated)
- Committer:
- hollegha2
- Date:
- Thu Dec 04 10:10:46 2014 +0000
- Revision:
- 0:ba1bd1c2656f
xx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hollegha2 | 0:ba1bd1c2656f | 1 | #include "mbed.h" |
hollegha2 | 0:ba1bd1c2656f | 2 | |
hollegha2 | 0:ba1bd1c2656f | 3 | // Das DigitalOut-Objekt d17 mit dem Pin P1_6 am uC verbinden |
hollegha2 | 0:ba1bd1c2656f | 4 | // damit ist P1_6 als Ausgang geschaltet |
hollegha2 | 0:ba1bd1c2656f | 5 | DigitalOut d17(P1_6); |
hollegha2 | 0:ba1bd1c2656f | 6 | DigitalOut d18(P1_7); |
hollegha2 | 0:ba1bd1c2656f | 7 | DigitalOut d19(P1_12); |
hollegha2 | 0:ba1bd1c2656f | 8 | DigitalOut d20(P1_13); |
hollegha2 | 0:ba1bd1c2656f | 9 | |
hollegha2 | 0:ba1bd1c2656f | 10 | void main() |
hollegha2 | 0:ba1bd1c2656f | 11 | { |
hollegha2 | 0:ba1bd1c2656f | 12 | // alle Ports definiert auf 0 setzen |
hollegha2 | 0:ba1bd1c2656f | 13 | d17.write(0); d18.write(0); |
hollegha2 | 0:ba1bd1c2656f | 14 | // d17.write(0); d17=0; bewirkt dasselbe |
hollegha2 | 0:ba1bd1c2656f | 15 | d19=0; d20=0; |
hollegha2 | 0:ba1bd1c2656f | 16 | // super simples Lauflicht# |
hollegha2 | 0:ba1bd1c2656f | 17 | while(1) |
hollegha2 | 0:ba1bd1c2656f | 18 | { |
hollegha2 | 0:ba1bd1c2656f | 19 | d17=1; |
hollegha2 | 0:ba1bd1c2656f | 20 | wait_ms(200); |
hollegha2 | 0:ba1bd1c2656f | 21 | d17=0; d18=1; |
hollegha2 | 0:ba1bd1c2656f | 22 | wait_ms(200); |
hollegha2 | 0:ba1bd1c2656f | 23 | d18=0; d19=0; |
hollegha2 | 0:ba1bd1c2656f | 24 | } |
hollegha2 | 0:ba1bd1c2656f | 25 | } |