Task 3

Dependencies:   mbed

Fork of Liniensensor_2 by Dominik Weiss

Mein Projekt:

Dieses Projekt habe ich im SS 2015 in FSST programmiert 3. While Task

Files at this revision

API Documentation at this revision

Comitter:
Dominik32
Date:
Fri Apr 24 08:09:42 2015 +0000
Parent:
3:8587d08d9f65
Commit message:
While Task 3

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Apr 24 07:46:09 2015 +0000
+++ b/main.cpp	Fri Apr 24 08:09:42 2015 +0000
@@ -10,25 +10,42 @@
 
 int main()
 {
-    ur_Bertl karel;
-    int x = 0;
+    Alle_Befehle karel;
+    int x =0;
+    
     
     while(1)
     {
-        while(karel.NextToABeeper())
-        {       
-            karel.Move();
+        
+        while(!karel.NextToABeeper() && karel.FrontIsClear())
+        {
+            karel.Move();        
         }
-        karel.MoveBackwards();
+        
         karel.TurnLeft();
-        x = x++;
         
-        if ( x % 2 == 0) 
+        while(karel.NextToABeeper() && karel.FrontIsClear())
         {
-            karel.TurnLeft();                       //Damit er nicht zurückfährt
+            karel.PickBeeper();
+            karel.Move();
+            x++;        
         }
         
+        karel.TurnAround();
+        
+        while(x>0)
+        {
+            karel.Move();
+            x--;
+        }
+        karel.TurnLeft();
+        karel.Move();
+        
     }
+        
+
+        
+    
     
 }