Liniensensor_Bendel

Dependencies:   BertlLib mbed

Fork of BertlTemplate2 by michael hollegha

Files at this revision

API Documentation at this revision

Comitter:
Lippi
Date:
Mon Mar 14 17:16:26 2016 +0000
Parent:
2:d24a3d2438a4
Child:
4:c157810a12c5
Commit message:
HL Bertl Lienenesensor

Changed in this revision

BertlTemplate.cpp Show diff for this revision Revisions of this file
LinienSensor_Pendel.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BertlTemplate.cpp	Mon Feb 22 10:55:46 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-#include "mbed.h"
-#include "Serial_HL.h"
-#include "Bertl14.h"
-#include "BertlObjects.h"
-
-//              main=2^0  LS    ENC 2^2
-BusOut boardPow(p30,      P1_6, P1_7);
-
-int main(void)
-{
-    boardPow=1; wait_ms(10);
-    InitBertl();
-    pex.useISR=0; leds=9;
-    pex.ClearLeds();
-    
-    while(1)
-    {
-    }
-    
-    return 1;
-}
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LinienSensor_Pendel.cpp	Mon Mar 14 17:16:26 2016 +0000
@@ -0,0 +1,43 @@
+
+#include "mbed.h"
+#include "Serial_HL.h"
+#include "Bertl14.h"
+#include "BertlObjects.h"
+
+//              main=2^0  LS    ENC 2^2
+BusOut boardPow(p30,      P1_6, P1_7);
+Timer t1, t2;
+AnalogInHL ls1(p18), ls2(p16), ls3(p20), ls4(p19), ls5(p17);
+
+
+int main(void)
+{
+    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);
+        }
+        else
+        {
+            mL.SetPow(0.3);
+            mR.SetPow(0.1);
+        }  
+        } 
+       
+    }
+
+    return 1;
+}