on Motor

Dependencies:   encoderKRAI mbed Motor_new

Revision:
8:069a607ef761
Parent:
7:68af06a391f0
Child:
9:383084a01131
--- a/main.cpp	Fri May 17 10:03:49 2019 +0000
+++ b/main.cpp	Sun May 19 17:18:14 2019 +0000
@@ -70,7 +70,10 @@
         
         last_galat = galat;
         pc.printf("%f.2 \n",pwm);
-        if (fabs(galat) > 150){
+        if (fabs(total_pulse_in_degree) > 120){
+            main_motor.speed(0);
+            main_motor.brake(1);            
+            not_stop = 0;
             break;
         }
     }
@@ -78,13 +81,16 @@
 int t1;
 
 int main(){
+    pneu = 1;
     encoder.reset();
     int state = 1;
     wait(1);
     count_ball = 0;
+    
     while (count_ball<6){
         pc.printf("%d \n",count_ball);
         if (state && !infrared) {
+            wait(1);
             state = 0 ;
             pneu = 0;                   // menembakkan bola
             wait(1);