motor aansturing moet lineair zijn is het niet

Dependencies:   MODSERIAL Encoder mbed HIDScope

Revision:
8:83d522d8f2b8
Parent:
7:eb239942830d
Child:
9:f907915f269c
--- a/main.cpp	Mon Sep 28 12:25:41 2015 +0000
+++ b/main.cpp	Mon Sep 28 12:28:33 2015 +0000
@@ -34,13 +34,13 @@
 DigitalIn button(PTA4);
 int button_on = 0;
 
-void move_mot1(float left)
+void move_mot1(double left)
 {
     if(left < 0.400)
     {
-        float calc1 = left - 1;
-        float calc2 = abs(calc1);
-        float leftin1 = (calc2-0.6)*2.5 ;
+        double calc1 = left - 1;
+        double calc2 = abs(calc1);
+        double leftin1 = (calc2-0.6)*2.5 ;
         motor1_aan.write(leftin1);
         motor1_rich.write(0);
     }
@@ -50,19 +50,19 @@
     }
     else if(left > 0.6000)
     {
-        float leftin2 = (left-0.6)*2.5;
+        double leftin2 = (left-0.6)*2.5;
         motor1_aan.write(leftin2);
         motor1_rich.write(1);
     }
 }
 
-void move_mot2(float right)
+void move_mot2(double right)
 {
     if(right < 0.4000)
     { 
-        float calc3 = right - 1;
-        float calc4 = abs(calc3);
-        float rightin1 = (calc4-0.6)*2.5 ;
+        double calc3 = right - 1;
+        double calc4 = abs(calc3);
+        double rightin1 = (calc4-0.6)*2.5 ;
         motor2_aan.write(rightin1);
         motor2_rich.write(0);
     }
@@ -72,7 +72,7 @@
     }
     else if(right > 0.6000)
     {
-        float rightin2 = (right-0.6)*2.5;
+        double rightin2 = (right-0.6)*2.5;
         motor2_aan.write(rightin2);
         motor2_rich.write(1);
     }
@@ -93,8 +93,8 @@
     mod.attach(&send,1);
     while(true)
     {
-        float left = potleft.read();
-        float right = potright.read();
+        double left = potleft.read();
+        double right = potright.read();
         // pc.printf("%f \n",left);
         move_mot1(left);
         move_mot2(right);