Motor Sensor

Dependencies:   mbed

Fork of BERTL14_MOTOR_SENSOR by Wolfgang Raimann

Files at this revision

API Documentation at this revision

Comitter:
Matthias_Praja
Date:
Fri Jan 08 16:00:48 2016 +0000
Parent:
0:9d98c838cffc
Commit message:
Motor Sensor

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue May 20 07:05:36 2014 +0000
+++ b/main.cpp	Fri Jan 08 16:00:48 2016 +0000
@@ -1,10 +1,6 @@
-/***********************************
-name:   BERTL_2014_MOTOR_SENSOR
-author: Wolfgang Raimann
-email:  rai@bulme.at
-description:
-    Die Reifen machen nach einem Reset genau eine Umdrehung (24 Impulse)
-***********************************/
+
+// Die Reifen machen nach einem Reset genau eine Umdrehung (24 Impulse)
+//***********************************/
 
 #include "mbed.h"
 
@@ -46,33 +42,33 @@
     // Richtungen werden bestimmt
     MotorL_FORWARD = MotorR_FORWARD = 1;
     // Periodendauer wird eingestellt
-    MotorL_EN.period_ms(10);
-    MotorR_EN.period_ms(10);
-    MotorL_EN = 0.5f;
-    MotorR_EN = 0.0f;
+    MotorL_EN.period_ms(20);
+    MotorR_EN.period_ms(20);
+    MotorL_EN = 1.0f;
+    MotorR_EN = 1.0f;
     
     while(1) {
-        if(cntMotorL_Sensor < 24){
-            if(MotorL_EN != 0.2f) MotorL_EN = 0.2f;
+        if(cntMotorL_Sensor < 30){
+            if(MotorL_EN != 5.0f) MotorL_EN = 5.0f;
             MotorL_FORWARD = 1;
             MotorL_REVERSE = 0;
-        } else if(cntMotorL_Sensor > 24){
-            if(MotorL_EN != 0.2f) MotorL_EN = 0.2f;
+        } else if(cntMotorL_Sensor > 30){
+            if(MotorL_EN != 5.0f) MotorL_EN = 5.0f;
             MotorL_FORWARD = 0;
             MotorL_REVERSE = 1;
-        } else if(MotorL_EN != 0.0f){
-            MotorL_EN = 0.0f;
+        } else if(MotorL_EN != 2.0f){
+            MotorL_EN = 2.0f;
         }
-        if(cntMotorR_Sensor < 24){
-            if(MotorR_EN != 0.2f) MotorR_EN = 0.2f;
+        if(cntMotorR_Sensor < 30){
+            if(MotorR_EN != 5.0f) MotorR_EN = 5.0f;
             MotorR_FORWARD = 1;
             MotorR_REVERSE = 0;
-        } else if(cntMotorR_Sensor > 24){
-            if(MotorR_EN != 0.2f) MotorR_EN = 0.2f;
+        } else if(cntMotorR_Sensor > 30){
+            if(MotorR_EN != 5.0f) MotorR_EN = 5.0f;
             MotorR_FORWARD = 0;
             MotorR_REVERSE = 1;
-        } else if(MotorR_EN != 0.0f){
-            MotorR_EN = 0.0f;
+        } else if(MotorR_EN != 2.0f){
+            MotorR_EN = 2.0f;
         }
     }
 }