Kodingan 5 April setting kecepatan power screw

Dependencies:   DigitDisplay Motor PID Ping mbed millis

Fork of MainProgram_BaseBaru_fix_omni12Feb by KRAI 2017

Revision:
13:8ab42383a2ca
Parent:
12:e07c59c28c29
Child:
20:54dc93e7b016
--- a/JoystickPS3.h	Sat Dec 03 05:43:10 2016 +0000
+++ b/JoystickPS3.h	Fri Dec 09 10:27:56 2016 +0000
@@ -81,6 +81,23 @@
         SELECT = (bool)((RL >> 5) & 0x1);
         PS = (bool)((RL >> 6) & 0x1);
     
+        // R2 click dan L2 click
+        if (R2 > 100) {
+            if ( R2sebelum) { R2_click = false;
+                } else { R2_click = true;}   
+            R2sebelum = true; 
+        }else { 
+            R2sebelum = false;
+            R2_click = false;
+        }            
+        if (L2 > 100) {
+            if ( R2sebelum) { L2_click = false;
+                } else { L2_click = true;}   
+            L2sebelum = true; 
+        }else { L2sebelum = false;
+                L2_click = false;
+            }            
+    
         segitiga_click = (bool)((button_click >> 0) & 0x1);
         lingkaran_click = (bool)((button_click >> 1) & 0x1);
         silang_click = (bool)((button_click >> 2) & 0x1);
@@ -115,6 +132,8 @@
         RL = 0;
         button_click = 0;
         RL_click = 0;
+        R2_click =0;
+        L2_click =0;
         R2 = 0;
         L2 = 0;
         RX = 0;
@@ -185,7 +204,8 @@
     
     bool kiri_click, kanan_click, atas_click, bawah_click;
     bool segitiga_click, lingkaran_click, kotak_click, silang_click;
-    bool L1_click, R1_click, L3_click, R3_click;
+    bool L1_click, R1_click, L3_click, R3_click, R2_click, L2_click;
+    bool R2sebelum,L2sebelum;
     bool START_click, SELECT_click, PS_click;
   
 protected: