
ayio bukkka insadinsaofno
Dependencies: encoderKRAI mbed Motor_new
OE tadi udah di commit
Revision 10:95e41bc4252c, committed 2019-05-19
- Comitter:
- oktavianusirvan
- Date:
- Sun May 19 20:06:39 2019 +0000
- Parent:
- 9:383084a01131
- Commit message:
- ini final(mudah-mudahan)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 383084a01131 -r 95e41bc4252c main.cpp --- 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 ;