![](/media/cache/profiles/38fcf18b093fdaa9016a4b84255dfcaf.jpg.50x50_q85.jpg)
Bertl sammelt Beeper und fährt die anzahl der Beeper nach oben und fährt zum Ausgangspunkt.
Fork of While_Task3 by
Revision 1:d8c1ed589950, committed 2015-05-08
- Comitter:
- DoTTi
- Date:
- Fri May 08 09:19:03 2015 +0000
- Parent:
- 0:27a5933a5e04
- Commit message:
- Bertl sammelt Beeper und f?hrt die anzahl der Beeper nach oben und f?hrt zum Ausgangspunkt.
Changed in this revision
diff -r 27a5933a5e04 -r d8c1ed589950 Robot.lib --- a/Robot.lib Fri Apr 24 08:44:37 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#207a1e646191
diff -r 27a5933a5e04 -r d8c1ed589950 main.cpp --- a/main.cpp Fri Apr 24 08:44:37 2015 +0000 +++ b/main.cpp Fri May 08 09:19:03 2015 +0000 @@ -1,32 +1,33 @@ +/** Beschreibung +*/ + #include "mbed.h" #include "Robot.h" #include "const.h" -class Bertl_Beeper : public Robot +int Beeper=0; +int move=0; + +class Bertl_Beeper : public Bertl { public: - void ClearAllBeeperToTheWall(); - void TurnAround(); + void PickAllBeeperToTheWall(); }; -void Bertl_Beeper :: TurnAround() -{ - TurnLeft(); - TurnLeft(); -} - -void Bertl_Beeper :: ClearAllBeeperToTheWall() +void Bertl_Beeper :: PickAllBeeperToTheWall() { while(FrontIsClear()) { if(NextToABeeper()) { PickBeeper(); + Beeper++; NibbleLeds(AnyBeeperInBag()); wait(1); Move(); } else Move(); + move++; } } @@ -36,11 +37,20 @@ while(1) { - karel.ClearAllBeeperToTheWall(); + karel.PickAllBeeperToTheWall(); while(!karel.FrontIsClear()) { - karel.TurnAround(); + 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); + } \ No newline at end of file
diff -r 27a5933a5e04 -r d8c1ed589950 ur_Bertl.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ur_Bertl.lib Fri May 08 09:19:03 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#3ce84646fd74