on Motor

Dependencies:   encoderKRAI mbed Motor_new

Revision:
10:95e41bc4252c
Parent:
9:383084a01131
Child:
11:38e621509cdc
--- a/main.cpp	Sun May 19 18:54:54 2019 +0000
+++ b/main.cpp	Sun May 19 20:06:39 2019 +0000
@@ -54,11 +54,11 @@
         galat = theta - total_pulse_in_degree;
         derivative = galat - last_galat;
         integral += galat;
-        pwm =  (0.01*galat)+(derivative) ;
+        pwm =  (0.0165*galat)+(derivative) ;
 
         //limit the power of motor, the max power can be changed
-        if (pwm > 0.4) pwm = 0.4;
-        else if (pwm < -0.4) pwm = -0.4;
+        if (pwm > 0.6) pwm = 0.6;
+        else if (pwm < -0.6) pwm = -0.6;
         // set speed motor
         if (fabs(galat) > 0.6 || (fabs(pwm) > 0.1)) main_motor.speed(pwm);
         else {
@@ -88,7 +88,7 @@
     count_ball = 0;
     
     while (count_ball<6){
-        pc.printf("%d \n",count_ball);
+        pc.printf("%f.2 \n", total_pulse_in_degree);
         if (state && !infrared) {
             wait(1); 
             state = 0 ;