bug : pwm full di launcher

Dependencies:   Motor PID Joystick_OrdoV5 mbed millis

Fork of MainProgram_BaseBaru by KRAI 2017

Revision:
29:7b372b0aaa61
Parent:
28:2d0746dc2d7d
Child:
30:d69cc27ac644
--- a/main.cpp	Fri Feb 10 19:18:55 2017 +0000
+++ b/main.cpp	Sun Feb 12 08:07:04 2017 +0000
@@ -70,27 +70,27 @@
 float speedT    = 0.2;
 float vpid      = 0;
 float pwmP      = 0.5;
-float pwmT      = -0.8;
+float pwmT      = -0.95;
 
 
 /* Deklarasi Encoder Base */
 encoderKRAI encoderKiri(PC_4, PB_15, 2000, encoderKRAI::X2_ENCODING);   //inA, inB, pin Indeks (NC = tak ada), resolusi, pembacaan
 
 /* Deklarasi Encoder Launcher */
-encoderKRAI encoderAtas( PB_13, PB_14, 28, encoderKRAI::X2_ENCODING);
-encoderKRAI encoderAtas2( PB_15, PC_4, 28, encoderKRAI::X2_ENCODING);
+encoderKRAI encoderAtas( PC_10, PC_11, 28, encoderKRAI::X2_ENCODING);
+encoderKRAI encoderAtas2( PD_2, PC_12, 28, encoderKRAI::X2_ENCODING);
 
 /* Deklarasi Motor Base */
-Motor motor1(PB_9, PC_5, PA_12);    // pwm, fwd, rev, Motor Depan
+Motor motor1(PB_9, PA_12, PC_5);    // pwm, fwd, rev, Motor Depan
 Motor motor2(PB_6, PB_1, PB_12);    // pwm, fwd, rev, Motor Belakang
 
 /* Deklarasi Motor Launcher */
-Motor motorL1(PA_8,PC_1,PC_2);    // pwm ,fwd, rev, Motor Launcher1
-Motor motorL3(PA_10, PC_0, PC_3); // pwm, fwd, rev, Motor Launcher2 
-Motor motorP(PC_7, PC_14, PC_13); // pwm, fwd, rev, Motor Powerscrew                
+Motor motorL1(PA_8,PC_2,PC_1);    // pwm ,fwd, rev, Motor Launcher1
+Motor motorL3(PA_10, PC_3, PC_0); // pwm, fwd, rev, Motor Launcher2 
+Motor motorP(PB_7, PA_14, PA_15); // pwm, fwd, rev, Motor Powerscrew                
 
 /* Deklarasi Penumatik Launcher */
-DigitalOut pneumatik(PB_2, 0);
+DigitalOut pneumatik(PB_3, PullUp);
 
 /*Dekalrasi Limit Switch */
 DigitalIn limitA (PC_9, PullUp);
@@ -179,6 +179,7 @@
     if (reload){
         if (!limitA){
             motorP.brake (1);
+            wait_ms(1000);
         }
         else
         {
@@ -190,9 +191,9 @@
                     motorP.speed(pwmT);
                 }
                 motorP.brake(1);
+                reload = !reload;
             }
         }
-        reload = !reload;
     }
     
 /*Motor Atas*/
@@ -243,6 +244,12 @@
             encoderAtas2.getPulses();
         }
     }
+    else
+    {
+        motorL1.brake(1);
+        motorL3.brake(1);
+    }
+    
     
     // MOTOR Bawah
     switch (case_ger) {
@@ -361,9 +368,9 @@
                 launcher = !launcher;
             }
             if (joystick.lingkaran_click){
+                pneumatik = 0;
+                wait_ms(1000);
                 pneumatik = 1;
-                wait_ms(500);
-                pneumatik = 0;
             }
             speedKalibrasiMotor();
             if (joystick.silang_click){