Update 18 Februari 2017, PID laucnher dan Base sudah diperbarui

Dependencies:   Motor PID Joystick_OrdoV5 mbed millis

Fork of MainProgram_BaseBaru_otomatis-reloader by KRAI 2017

Revision:
18:1da121ddb7c1
Parent:
17:e4229d77a5ab
Child:
19:38f148ce00f0
--- a/main.cpp	Fri Jan 27 14:42:17 2017 +0000
+++ b/main.cpp	Fri Jan 27 16:20:44 2017 +0000
@@ -107,7 +107,8 @@
 
 /* Variabel Stick */
 char case_ger;
-bool launcher = false, servoGo = false, manual = true, caseTadi = false, caseSekarang = false;
+bool launcher = false, servoGo = false, manual = true;
+int  caseSebelum;
 
 /***********************************************/
 /*         Deklarasi Fungsi dan Procedure      */
@@ -163,12 +164,10 @@
     else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(joystick.kanan)&&(!joystick.kiri))  {   
         // Kanan
         casegerak = 9;
-        caseSekarang = true;
     } 
     else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(joystick.kiri)) {   
         // Kiri
-        casegerak = 10; 
-        caseSekarang = true;       
+        casegerak = 10;       
     } 
     else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(!joystick.kiri)) {  
         casegerak = 12; 
@@ -340,19 +339,20 @@
             }
             case (9) :{   
             // Kanan
-                if (caseSekarang != caseTadi)   XT = XT + PERPINDAHAN;
-                caseTadi = caseSekarang;
+                if (case_ger == caseSebelum) XT = XT + PERPINDAHAN;
                 
+
             break;
             }
             case (10) :{  
             // Kiri 
-                if (caseSekarang!= caseTadi)    XT = XT - PERPINDAHAN;
-                caseTadi = caseSekarang;
+                if (case_ger == caseSebelum) XT = XT - PERPINDAHAN;
+                
             break;
             }
             default :{}  
         }   //end of switch
+        caseSebelum = case_ger;
     }
 }