Alexander Leber
/
BertlButtons
LEDs zeigen welche Taster gedrückt werden.
main.cpp@0:6d28be2dcb7c, 2015-04-16 (annotated)
- Committer:
- DoTTi
- Date:
- Thu Apr 16 11:36:46 2015 +0000
- Revision:
- 0:6d28be2dcb7c
LED zeigen welchen Taster gedr?ckt werden.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DoTTi | 0:6d28be2dcb7c | 1 | #include "mbed.h" |
DoTTi | 0:6d28be2dcb7c | 2 | #include "const.h" |
DoTTi | 0:6d28be2dcb7c | 3 | #include "ur_Bertl.h" |
DoTTi | 0:6d28be2dcb7c | 4 | |
DoTTi | 0:6d28be2dcb7c | 5 | int main() |
DoTTi | 0:6d28be2dcb7c | 6 | { |
DoTTi | 0:6d28be2dcb7c | 7 | ur_Bertl karel; |
DoTTi | 0:6d28be2dcb7c | 8 | |
DoTTi | 0:6d28be2dcb7c | 9 | karel.TurnLedOff(LED_ALL); |
DoTTi | 0:6d28be2dcb7c | 10 | while(1) |
DoTTi | 0:6d28be2dcb7c | 11 | { |
DoTTi | 0:6d28be2dcb7c | 12 | if( karel.IsButtonPressed(BTN_FLL)) |
DoTTi | 0:6d28be2dcb7c | 13 | karel.NibbleLeds(0x01); |
DoTTi | 0:6d28be2dcb7c | 14 | |
DoTTi | 0:6d28be2dcb7c | 15 | if( karel.IsButtonPressed(BTN_FL)) |
DoTTi | 0:6d28be2dcb7c | 16 | karel.NibbleLeds(0x02); |
DoTTi | 0:6d28be2dcb7c | 17 | |
DoTTi | 0:6d28be2dcb7c | 18 | if( karel.IsButtonPressed(BTN_FM)) |
DoTTi | 0:6d28be2dcb7c | 19 | karel.NibbleLeds(0x0F); |
DoTTi | 0:6d28be2dcb7c | 20 | |
DoTTi | 0:6d28be2dcb7c | 21 | if( karel.IsButtonPressed(BTN_FR)) |
DoTTi | 0:6d28be2dcb7c | 22 | karel.NibbleLeds(0x04); |
DoTTi | 0:6d28be2dcb7c | 23 | |
DoTTi | 0:6d28be2dcb7c | 24 | if( karel.IsButtonPressed(BTN_FRR)) |
DoTTi | 0:6d28be2dcb7c | 25 | karel.NibbleLeds(0x08); |
DoTTi | 0:6d28be2dcb7c | 26 | |
DoTTi | 0:6d28be2dcb7c | 27 | if( karel.IsButtonPressed(BTN_BL)) |
DoTTi | 0:6d28be2dcb7c | 28 | karel.NibbleLeds(0x0E); |
DoTTi | 0:6d28be2dcb7c | 29 | |
DoTTi | 0:6d28be2dcb7c | 30 | if( karel.IsButtonPressed(BTN_BM)) |
DoTTi | 0:6d28be2dcb7c | 31 | karel.NibbleLeds(0x09); |
DoTTi | 0:6d28be2dcb7c | 32 | |
DoTTi | 0:6d28be2dcb7c | 33 | if( karel.IsButtonPressed(BTN_BR)) |
DoTTi | 0:6d28be2dcb7c | 34 | karel.NibbleLeds(0x07); |
DoTTi | 0:6d28be2dcb7c | 35 | |
DoTTi | 0:6d28be2dcb7c | 36 | else |
DoTTi | 0:6d28be2dcb7c | 37 | karel.NibbleLeds(0x00); |
DoTTi | 0:6d28be2dcb7c | 38 | |
DoTTi | 0:6d28be2dcb7c | 39 | } |
DoTTi | 0:6d28be2dcb7c | 40 | } |