Julian Roll
/
while_Bertl123
while_Bertl Funktionen mit Task3
Fork of while_Bertl by
Revision 1:b6d7de0d8613, committed 2015-04-24
- Comitter:
- Pouter123
- Date:
- Fri Apr 24 08:13:05 2015 +0000
- Parent:
- 0:1d90336fdde0
- Commit message:
- while_Bertl
Changed in this revision
NewClass.cpp | Show annotated file Show diff for this revision Revisions of this file |
NewClass.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1d90336fdde0 -r b6d7de0d8613 NewClass.cpp --- a/NewClass.cpp Thu Apr 23 12:51:22 2015 +0000 +++ b/NewClass.cpp Fri Apr 24 08:13:05 2015 +0000 @@ -27,4 +27,35 @@ } PickBeeper(); +} + +void NewClass :: Task3() +{ +int x = 0; + while(FrontIsClear()) + { + Move(); + if((NextToABeeper())&&(x==0)) + { + PickBeeper(); + TurnLeft(); + x++; + } + else if(NextToABeeper()) + { + PickBeeper(); + x++; + } + else + { + TurnLeft(); + TurnLeft(); + for(int i = 0; i <= (x-1); x++) + Move(); + TurnLeft(); + if(FrontIsClear()) + Move(); + x = 0; + } + } } \ No newline at end of file
diff -r 1d90336fdde0 -r b6d7de0d8613 NewClass.h --- a/NewClass.h Thu Apr 23 12:51:22 2015 +0000 +++ b/NewClass.h Fri Apr 24 08:13:05 2015 +0000 @@ -1,3 +1,4 @@ +#include "mbed.h" #include "ur_Bertl.h" #include "const.h" #include "config.h" @@ -10,6 +11,7 @@ public: void ClearAllBeepersToTheWall(); void MoveUntilPickBeeper(); + void Task3(); };