Jozsef Sztojka
/
Bertl_Aufgabe_5
5. Aufgabe mit dem Bertl
main.cpp@0:83796a4f431d, 2015-11-30 (annotated)
- Committer:
- Joci1221
- Date:
- Mon Nov 30 14:24:45 2015 +0000
- Revision:
- 0:83796a4f431d
Bertl Aufgabe 5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Joci1221 | 0:83796a4f431d | 1 | #include "mbed.h" |
Joci1221 | 0:83796a4f431d | 2 | #include "Robot.h" |
Joci1221 | 0:83796a4f431d | 3 | #include "const.h" |
Joci1221 | 0:83796a4f431d | 4 | |
Joci1221 | 0:83796a4f431d | 5 | DigitalOut myled(LED1); |
Joci1221 | 0:83796a4f431d | 6 | Robot bertl; |
Joci1221 | 0:83796a4f431d | 7 | int main() |
Joci1221 | 0:83796a4f431d | 8 | { |
Joci1221 | 0:83796a4f431d | 9 | bertl.RGBLed(0 |
Joci1221 | 0:83796a4f431d | 10 | , 0, 0); |
Joci1221 | 0:83796a4f431d | 11 | while(1) |
Joci1221 | 0:83796a4f431d | 12 | { |
Joci1221 | 0:83796a4f431d | 13 | bertl.TurnLedOn(LED_FR1); |
Joci1221 | 0:83796a4f431d | 14 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 15 | { |
Joci1221 | 0:83796a4f431d | 16 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 17 | } |
Joci1221 | 0:83796a4f431d | 18 | bertl.TurnLedOff(LED_FR1); |
Joci1221 | 0:83796a4f431d | 19 | |
Joci1221 | 0:83796a4f431d | 20 | bertl.TurnLedOn(LED_FR2); |
Joci1221 | 0:83796a4f431d | 21 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 22 | { |
Joci1221 | 0:83796a4f431d | 23 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 24 | } |
Joci1221 | 0:83796a4f431d | 25 | bertl.TurnLedOff(LED_FR2); |
Joci1221 | 0:83796a4f431d | 26 | |
Joci1221 | 0:83796a4f431d | 27 | bertl.TurnLedOn(LED_BR2); |
Joci1221 | 0:83796a4f431d | 28 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 29 | { |
Joci1221 | 0:83796a4f431d | 30 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 31 | } |
Joci1221 | 0:83796a4f431d | 32 | bertl.TurnLedOff(LED_BR2); |
Joci1221 | 0:83796a4f431d | 33 | |
Joci1221 | 0:83796a4f431d | 34 | bertl.TurnLedOn(LED_BR1); |
Joci1221 | 0:83796a4f431d | 35 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 36 | { |
Joci1221 | 0:83796a4f431d | 37 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 38 | } |
Joci1221 | 0:83796a4f431d | 39 | bertl.TurnLedOff(LED_BR1); |
Joci1221 | 0:83796a4f431d | 40 | |
Joci1221 | 0:83796a4f431d | 41 | bertl.NibbleLeds(0x08); |
Joci1221 | 0:83796a4f431d | 42 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 43 | { |
Joci1221 | 0:83796a4f431d | 44 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 45 | } |
Joci1221 | 0:83796a4f431d | 46 | wait(0.2); |
Joci1221 | 0:83796a4f431d | 47 | bertl.NibbleLeds(0x04); |
Joci1221 | 0:83796a4f431d | 48 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 49 | { |
Joci1221 | 0:83796a4f431d | 50 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 51 | } |
Joci1221 | 0:83796a4f431d | 52 | wait(0.2); |
Joci1221 | 0:83796a4f431d | 53 | bertl.NibbleLeds(0x02); |
Joci1221 | 0:83796a4f431d | 54 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 55 | { |
Joci1221 | 0:83796a4f431d | 56 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 57 | } |
Joci1221 | 0:83796a4f431d | 58 | wait(0.2); |
Joci1221 | 0:83796a4f431d | 59 | bertl.NibbleLeds(0x01); |
Joci1221 | 0:83796a4f431d | 60 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 61 | { |
Joci1221 | 0:83796a4f431d | 62 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 63 | } |
Joci1221 | 0:83796a4f431d | 64 | wait(0.2); |
Joci1221 | 0:83796a4f431d | 65 | bertl.NibbleLeds(0x00); |
Joci1221 | 0:83796a4f431d | 66 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 67 | { |
Joci1221 | 0:83796a4f431d | 68 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 69 | } |
Joci1221 | 0:83796a4f431d | 70 | bertl.TurnLedOn(LED_BL2); |
Joci1221 | 0:83796a4f431d | 71 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 72 | { |
Joci1221 | 0:83796a4f431d | 73 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 74 | } |
Joci1221 | 0:83796a4f431d | 75 | bertl.TurnLedOff(LED_BL2); |
Joci1221 | 0:83796a4f431d | 76 | |
Joci1221 | 0:83796a4f431d | 77 | bertl.TurnLedOn(LED_BL1); |
Joci1221 | 0:83796a4f431d | 78 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 79 | { |
Joci1221 | 0:83796a4f431d | 80 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 81 | } |
Joci1221 | 0:83796a4f431d | 82 | bertl.TurnLedOff(LED_BL1); |
Joci1221 | 0:83796a4f431d | 83 | |
Joci1221 | 0:83796a4f431d | 84 | bertl.TurnLedOn(LED_FL2); |
Joci1221 | 0:83796a4f431d | 85 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 86 | { |
Joci1221 | 0:83796a4f431d | 87 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 88 | } |
Joci1221 | 0:83796a4f431d | 89 | bertl.TurnLedOff(LED_FL2); |
Joci1221 | 0:83796a4f431d | 90 | |
Joci1221 | 0:83796a4f431d | 91 | bertl.TurnLedOn(LED_FL1); |
Joci1221 | 0:83796a4f431d | 92 | while (bertl.WaitUntilButtonPressed()) |
Joci1221 | 0:83796a4f431d | 93 | { |
Joci1221 | 0:83796a4f431d | 94 | wait(0.05); |
Joci1221 | 0:83796a4f431d | 95 | } |
Joci1221 | 0:83796a4f431d | 96 | bertl.TurnLedOff(LED_FL1); |
Joci1221 | 0:83796a4f431d | 97 | } |
Joci1221 | 0:83796a4f431d | 98 | } |