Sebastian Stroissnigg
/
BeeperZaehler
Fährt und zählt bis Taster (vorne mitte) feuert, gibt dann aus und dreht nach links
main.cpp@3:f92c6d90b328, 2015-05-08 (annotated)
- Committer:
- SebiStr99
- Date:
- Fri May 08 16:27:21 2015 +0000
- Revision:
- 3:f92c6d90b328
- Parent:
- 2:693d7cc52ed1
- Child:
- 4:d66cee2c040e
F?hrt und Z?hlt Beeper
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SebiStr99 | 0:d50c9e76e8f7 | 1 | #include "mbed.h" |
SebiStr99 | 0:d50c9e76e8f7 | 2 | #include "ur_Bertl.h" |
SebiStr99 | 0:d50c9e76e8f7 | 3 | #include "Beeper_Bertl.h" |
SebiStr99 | 0:d50c9e76e8f7 | 4 | |
SebiStr99 | 0:d50c9e76e8f7 | 5 | Serial bt(p9, p10); |
SebiStr99 | 0:d50c9e76e8f7 | 6 | |
SebiStr99 | 0:d50c9e76e8f7 | 7 | void main() |
SebiStr99 | 0:d50c9e76e8f7 | 8 | { |
SebiStr99 | 0:d50c9e76e8f7 | 9 | Bertl karel; |
SebiStr99 | 0:d50c9e76e8f7 | 10 | |
SebiStr99 | 0:d50c9e76e8f7 | 11 | int Beeper = 0; |
SebiStr99 | 0:d50c9e76e8f7 | 12 | int moves = 0; |
SebiStr99 | 0:d50c9e76e8f7 | 13 | |
SebiStr99 | 0:d50c9e76e8f7 | 14 | while(1) |
SebiStr99 | 0:d50c9e76e8f7 | 15 | { |
SebiStr99 | 3:f92c6d90b328 | 16 | karel.Move(50); |
SebiStr99 | 0:d50c9e76e8f7 | 17 | moves++; |
SebiStr99 | 1:721291a8c3ee | 18 | if(karel.NextToABeeper()) |
SebiStr99 | 0:d50c9e76e8f7 | 19 | { |
SebiStr99 | 0:d50c9e76e8f7 | 20 | Beeper++; |
SebiStr99 | 3:f92c6d90b328 | 21 | bt.printf("%i. Beeper", Beeper); |
SebiStr99 | 3:f92c6d90b328 | 22 | karel.Move(50); |
SebiStr99 | 3:f92c6d90b328 | 23 | moves++; |
SebiStr99 | 3:f92c6d90b328 | 24 | } |
SebiStr99 | 3:f92c6d90b328 | 25 | while(karel.NextToABeeper()) |
SebiStr99 | 3:f92c6d90b328 | 26 | { |
SebiStr99 | 3:f92c6d90b328 | 27 | karel.Move(50); |
SebiStr99 | 3:f92c6d90b328 | 28 | moves++; |
SebiStr99 | 0:d50c9e76e8f7 | 29 | } |
SebiStr99 | 0:d50c9e76e8f7 | 30 | |
SebiStr99 | 3:f92c6d90b328 | 31 | bt.printf("\nGesamt: Moves: %i; Beeper: %i", moves, Beeper); |
SebiStr99 | 1:721291a8c3ee | 32 | karel.ShutOff(); |
SebiStr99 | 0:d50c9e76e8f7 | 33 | } |
SebiStr99 | 0:d50c9e76e8f7 | 34 | } |