Bertl sammelt Beeper und fährt die anzahl der Beeper nach oben und fährt zum Ausgangspunkt.
Fork of While_Task3 by
main.cpp
- Committer:
- DoTTi
- Date:
- 2015-05-08
- Revision:
- 1:d8c1ed589950
- Parent:
- 0:27a5933a5e04
File content as of revision 1:d8c1ed589950:
/** Beschreibung */ #include "mbed.h" #include "Robot.h" #include "const.h" int Beeper=0; int move=0; class Bertl_Beeper : public Bertl { public: void PickAllBeeperToTheWall(); }; void Bertl_Beeper :: PickAllBeeperToTheWall() { while(FrontIsClear()) { if(NextToABeeper()) { PickBeeper(); Beeper++; NibbleLeds(AnyBeeperInBag()); wait(1); Move(); } else Move(); move++; } } int main() { Bertl_Beeper karel; while(1) { karel.PickAllBeeperToTheWall(); while(!karel.FrontIsClear()) { karel.TurnLeft(); break; } break; } for(int a=0; a<=Beeper;a++) karel.Move(Beeper); karel.TurnLeft(); for(int a=0; a<=move;a++) karel.Move(move); }