Liniensensor_Bendel

Dependencies:   BertlLib mbed

Fork of BertlTemplate2 by michael hollegha

Revision:
4:c157810a12c5
Parent:
3:b6754e794335
--- a/LinienSensor_Pendel.cpp	Mon Mar 14 17:16:26 2016 +0000
+++ b/LinienSensor_Pendel.cpp	Mon Apr 11 15:47:47 2016 +0000
@@ -9,35 +9,48 @@
 Timer t1, t2;
 AnalogInHL ls1(p18), ls2(p16), ls3(p20), ls4(p19), ls5(p17);
 
-
+void FollowUntilEnd ();
+void TurnUntilLine();
 int main(void)
 {
+    pex.WaitUntilFrontButtonPressed();
     boardPow=3;
     wait_ms(10);
     InitBertl();
     pex.useISR=0;
     leds=9;
     pex.ClearLeds();
-    t1.start();
-    t2.start();
     
-    while(1) {
-        pex.ReadButtons();
-        if(pex.IsButton(BTN_FM))
-        {
-        if (ls3.Read()>400)
-        {
-            mL.SetPow(0.1);
-            mR.SetPow(0.3);
+    while(1)
+    {
+        if (ls1.Read()>400 ) {
+            mL.SetPow(0.0);
+            mR.SetPow(0.25);
+            
         }
-        else
-        {
-            mL.SetPow(0.3);
-            mR.SetPow(0.1);
-        }  
-        } 
-       
+        else{
+             if (ls5.Read()>400) {
+                 mL.SetPow(0.25);
+                 mR.SetPow(0.0);
+                 }
+                 else{
+                    if (ls3.Read()>400  && ls4.Read()>400 && ls2.Read()>400)  {
+                    mL.SetPow(0.25);
+                    mR.SetPow(0.25);
+                    }
+                }
+            }
+      
+            return;
+         
+    //wait_ms(1000);
+    //FollowUntilEnd ();
+   // wait_ms(1000);
+   // TurnUntilLine();
     }
+    
 
-    return 1;
+
+
 }
+