ClearAllBeepersToTheWall

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
GreenOrange
Date:
Fri Apr 24 08:17:17 2015 +0000
Parent:
0:6ff8c2bfa876
Commit message:
ClearAllBeepersToTheWall

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6ff8c2bfa876 -r 427aa180d290 main.cpp
--- a/main.cpp	Thu Apr 23 12:15:03 2015 +0000
+++ b/main.cpp	Fri Apr 24 08:17:17 2015 +0000
@@ -3,23 +3,27 @@
 
 int main()
 {
-    int a = 0;
     ur_Bertl karel;
-
-while(1)
+    
+   
+    for(int i = 0; i < 3; i++)
     {
         while(!karel.NextToABeeper())
-            {
-                karel.Move();    
-            }
+        {
+            karel.Move();   
+        }
         
-        if(a <= 3)
-            karel.PickBeeper();
-            a++;
-    
-    
+
+        karel.PickBeeper();
+        karel.NibbleLeds(karel.AnyBeeperInBag());
+        wait(1);
+        if(i != 3)
+        {
+            while(karel.NextToABeeper())
+                {
+                    karel.Move();
+                }
+        }
     }
 }
 
-
-