Zählt "Moves" und Beepers

Dependencies:   mbed ur_Bertl

Meine Projekte

Text
fff
Task_if: Code


  1. a
  2. b
    1. b.1
Revision:
1:7d54ee7806ed
Parent:
0:3a81205181c5
Child:
3:bd72c5d54747
--- a/uebungen.cpp	Thu Apr 23 12:37:25 2015 +0000
+++ b/uebungen.cpp	Thu May 07 12:13:42 2015 +0000
@@ -2,39 +2,67 @@
 #include "const.h"
 
 
-bool Task_Bertl :: Front_Button()
+void Task_Bertl ::  LineFollow()
 {
-    if (FrontIsClear())
+    while(1)
     {
-        return  !IsButtonPressed(BTN_FLL);
-    } 
-    return false;
+        uint8_t val = GetLineValues();  
+        NibbleLeds(val);
+
+        if (val == 6)
+        {
+            Move();
+        }
+        if ((val == 1) || (val == 3) || (val == 7))
+        {
+            TurnLeftStep(1);
+        }
+        if ((val == 8) || (val == 12) || (val == 14))
+        {
+            TurnRigthStep(1);
+        }
+        if (val == 0)
+        {
+            break;
+        }
+
+        /*
+        if (val == 9)
+        {
+            Move();
+        }
+        if ((val == 14) || (val == 12) || (val == 8) || (val == 13))
+        {
+            TurnLeftStep(1);
+        }
+        if ((val == 7) || (val == 3) || (val == 1))
+        {
+            TurnRigthStep(1);
+        }
+        if (val == 15)
+        {
+            break;
+        }
+        */
+    }
 }
 
-
-bool Task_Bertl :: Front_Button2()
-{
-    if ((FrontIsClear())||(IsButtonPressed(BTN_FLL)))
-    {
-        return  true;
-    } 
-    return false;
-}
-
-void Task_Bertl :: ClearAllBeepersToTheWall()
+void Task_Bertl :: LineSearch()
 {
-    int i = 0;
-    while (!NextToABeeper() || FrontIsClear())
+     uint8_t val = GetLineValues();  
+     NibbleLeds(val);
+    
+    while(val != 9)
     {
-        Move();
         
-        if (NextToABeeper())
+        uint8_t val = GetLineValues();  
+        NibbleLeds(val);
+        
+        TurnLeftStep(1);
+        if (val == 9)
         {
-            wait(2);
-            i++;
-            PickBeeper();
-            NibbleLeds(i);
-            continue;
+            break;
         }
+                
     }
 }
\ No newline at end of file