Fix pisan inimah plis jangan revisi ultimate mantep

Dependencies:   DigitDisplay Motor PID mbed millis

Fork of DagonFly__RoadToJapan_15Mei by KRAI 2017

Revision:
45:964ae71a30e3
Parent:
44:452c214d9cf5
Child:
46:85169ae8659b
--- a/main.cpp	Wed Apr 05 12:54:03 2017 +0000
+++ b/main.cpp	Wed Apr 05 16:04:08 2017 +0000
@@ -78,6 +78,9 @@
 float PIVOT             = 0.17;      // PWM Pivot Kanan, Pivot Kiri
 float tuneDpn           = 0.80;     // Tunning PWM motor Depan
 float tuneBlk           = 0.80;     // Tunning PWM motor belakang
+float tuneAksel         = 0.6;
+int aksel               = 0;
+float tuneAkselBlk      = 0.4;
 float tuneR             = 0.78;
 float tuneL             = 0.72;
 float serong            = 0.4;
@@ -307,6 +310,11 @@
         // Power Screw Down
         caseJoystick = 12;       
     } 
+    else
+    {
+        tuneAksel = 0.6;
+        aksel = 0;
+    }
     
     return(caseJoystick);
 }
@@ -521,8 +529,12 @@
         case (3) : 
         {
             // Kanan
-            motorDpn.speed(-tuneDpn);
-            motorBlk.speed(tuneBlk);
+            aksel++;
+            if (aksel>300)
+                tuneAksel = 0.9;
+            
+            motorDpn.speed(-tuneAksel);
+            motorBlk.speed(tuneAksel);
             motorR.brake(1);
             motorL.brake(1);
             break;
@@ -530,8 +542,12 @@
         case (4) : 
         {
             // Kiri
-            motorDpn.speed(tuneDpn);
-            motorBlk.speed(-tuneBlk);
+            aksel++;
+            if (aksel>300)
+                tuneAksel = 0.9;
+                
+            motorDpn.speed(tuneAksel);
+            motorBlk.speed(-tuneAksel);
             motorR.brake(1);
             motorL.brake(1);
             break;
@@ -539,8 +555,12 @@
         case (8) : 
         {
             // Maju
-            motorR.speed(tuneR);
-            motorL.speed(-tuneL);
+            aksel++;
+            if (aksel>300)
+                tuneAksel = 0.9;
+            
+            motorR.speed(tuneAksel);
+            motorL.speed(-tuneAksel);
             motorDpn.brake(1);
             motorBlk.brake(1);
             break;
@@ -548,8 +568,12 @@
         case (9) : 
         {
             // Mundur
-            motorR.speed(-tuneR);
-            motorL.speed(tuneL);
+            aksel++;
+            if (aksel>300)
+                tuneAksel = 0.9;
+            
+            motorR.speed(-tuneAksel);
+            motorL.speed(tuneAksel);
             motorDpn.brake(1);
             motorBlk.brake(1);
             break;
@@ -585,6 +609,7 @@
                 previousMillis3 = millis();
                 flag_Pneu = true;
                 ready = false;
+                
             }
             break;
         }
@@ -628,6 +653,8 @@
         }
         default : 
         {
+            tuneAksel = 0.6;
+            aksel = 0;
             motorDpn.brake(1);
             motorBlk.brake(1);
             motorR.brake(1);