M Seiser
/
WHILE_TASK1
LEDs gehen an wenn Taster gedrückt
main.cpp@0:bb5edc977ef2, 2015-04-24 (annotated)
- Committer:
- mSeiser
- Date:
- Fri Apr 24 08:42:20 2015 +0000
- Revision:
- 0:bb5edc977ef2
Vorder und R?cklicht wie beim Auto
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mSeiser | 0:bb5edc977ef2 | 1 | #include "mbed.h" |
mSeiser | 0:bb5edc977ef2 | 2 | #include "ur_Bertl.h" |
mSeiser | 0:bb5edc977ef2 | 3 | #include "const.h" |
mSeiser | 0:bb5edc977ef2 | 4 | |
mSeiser | 0:bb5edc977ef2 | 5 | |
mSeiser | 0:bb5edc977ef2 | 6 | |
mSeiser | 0:bb5edc977ef2 | 7 | |
mSeiser | 0:bb5edc977ef2 | 8 | int main() |
mSeiser | 0:bb5edc977ef2 | 9 | { |
mSeiser | 0:bb5edc977ef2 | 10 | |
mSeiser | 0:bb5edc977ef2 | 11 | ur_Bertl karel; |
mSeiser | 0:bb5edc977ef2 | 12 | |
mSeiser | 0:bb5edc977ef2 | 13 | while(1) |
mSeiser | 0:bb5edc977ef2 | 14 | { |
mSeiser | 0:bb5edc977ef2 | 15 | if(karel.IsButtonPressed(BTN_FLL)) //linker Button vorne außen |
mSeiser | 0:bb5edc977ef2 | 16 | karel.TurnLedOn(0x01); |
mSeiser | 0:bb5edc977ef2 | 17 | if(karel.IsButtonPressed(BTN_FRR)) //rechter Button vorne außen |
mSeiser | 0:bb5edc977ef2 | 18 | karel.TurnLedOn(0x04); |
mSeiser | 0:bb5edc977ef2 | 19 | if(karel.IsButtonPressed(BTN_FRR)&&karel.IsButtonPressed(BTN_FLL)) |
mSeiser | 0:bb5edc977ef2 | 20 | karel.TurnLedOn(0x0F); |
mSeiser | 0:bb5edc977ef2 | 21 | if(karel.IsButtonPressed(BTN_BR)) //linker Button hinten außen |
mSeiser | 0:bb5edc977ef2 | 22 | karel.TurnLedOn(0x80); |
mSeiser | 0:bb5edc977ef2 | 23 | if(karel.IsButtonPressed(BTN_BL)) //rechter Button hinten außen |
mSeiser | 0:bb5edc977ef2 | 24 | karel.TurnLedOn(0x20); |
mSeiser | 0:bb5edc977ef2 | 25 | if(karel.IsButtonPressed(BTN_BR)&&(karel.IsButtonPressed(BTN_BL))) |
mSeiser | 0:bb5edc977ef2 | 26 | karel.TurnLedOn(0xF0); |
mSeiser | 0:bb5edc977ef2 | 27 | } |
mSeiser | 0:bb5edc977ef2 | 28 | |
mSeiser | 0:bb5edc977ef2 | 29 | |
mSeiser | 0:bb5edc977ef2 | 30 | } |
mSeiser | 0:bb5edc977ef2 | 31 | |
mSeiser | 0:bb5edc977ef2 | 32 |