Sebastian Stroissnigg
/
BeeperZaehler
Fährt und zählt bis Taster (vorne mitte) feuert, gibt dann aus und dreht nach links
main.cpp@1:721291a8c3ee, 2015-05-08 (annotated)
- Committer:
- SebiStr99
- Date:
- Fri May 08 16:08:00 2015 +0000
- Revision:
- 1:721291a8c3ee
- Parent:
- 0:d50c9e76e8f7
- Child:
- 2:693d7cc52ed1
Noch nicht getestet
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 | 1:721291a8c3ee | 16 | karel.Move(); |
SebiStr99 | 0:d50c9e76e8f7 | 17 | moves++; |
SebiStr99 | 1:721291a8c3ee | 18 | if(karel.NextToABeeper()) |
SebiStr99 | 0:d50c9e76e8f7 | 19 | { |
SebiStr99 | 0:d50c9e76e8f7 | 20 | Beeper++; |
SebiStr99 | 1:721291a8c3ee | 21 | bt.printf("%i Beeper", Beeper); |
SebiStr99 | 1:721291a8c3ee | 22 | karel.Move(); |
SebiStr99 | 0:d50c9e76e8f7 | 23 | while(karel.NextToABeeper()) |
SebiStr99 | 0:d50c9e76e8f7 | 24 | { |
SebiStr99 | 1:721291a8c3ee | 25 | karel.Move(); |
SebiStr99 | 0:d50c9e76e8f7 | 26 | } |
SebiStr99 | 0:d50c9e76e8f7 | 27 | } |
SebiStr99 | 0:d50c9e76e8f7 | 28 | |
SebiStr99 | 0:d50c9e76e8f7 | 29 | |
SebiStr99 | 1:721291a8c3ee | 30 | bt.printf("Gesamt: Moves: %i; Beeper: %i", moves, Beeper); |
SebiStr99 | 1:721291a8c3ee | 31 | karel.ShutOff(); |
SebiStr99 | 0:d50c9e76e8f7 | 32 | } |
SebiStr99 | 0:d50c9e76e8f7 | 33 | } |