main.cpp: Sensoren einlesen und Motoren ansteuern

Dependencies:   mbed

Revision:
4:e74c06e43485
Parent:
1:1adf5dfcc7bb
Child:
5:47262622a9bf
--- a/Motion.cpp	Tue Apr 10 14:31:50 2018 +0000
+++ b/Motion.cpp	Wed Apr 11 15:26:03 2018 +0000
@@ -4,8 +4,8 @@
 
 using namespace std;
 
-const float Motion::speedLeft = 50.0f;
-const float Motion::speedRight = 50.0f;
+const float Motion::SPEEDLEFT = 50.0f;
+const float Motion::SPEEDRIGHT = 50.0f;
 
 
 Motion::Motion(Controller& controller, EncoderCounter& counterLeft, 
@@ -27,8 +27,15 @@
         distanceC = irSensorC.read();
         distanceR = irSensorR.read();
         
-    controller.setDesiredSpeedLeft(speedLeft); //Drehzahl in [rpm]
-    controller.setDesiredSpeedRight(speedRight);
+    while(countsLeft  < 200 || countsRight < 200) { 
+        //Counts für eine Feld Bewegung
+        countsLeft = counterLeft.read();
+        countsRight = counterRight.read();
+    
+        controller.setDesiredSpeedLeft(50.0f);
+        controller.setDesiredSpeedRight(-50.0f);
+    
+    }
 }
     
 void Motion::rotateL() {