Source Code Robot Lama
Dependencies: DigitDisplay Motor PID Ping mbed millis
Fork of DagonFly__RoadToJapan_15Mei_Ultimate by
Revision 51:df6391c3fa68, committed 2017-05-15
- Comitter:
- MarchioKevin
- Date:
- Mon May 15 07:49:13 2017 +0000
- Parent:
- 50:8bc9dbca2ffa
- Commit message:
- Fix pisan ini mah plis jangan revisi lagi mantep
Changed in this revision
--- a/JoystickPS3.h Mon May 15 07:08:30 2017 +0000 +++ b/JoystickPS3.h Mon May 15 07:49:13 2017 +0000 @@ -95,7 +95,21 @@ }else { L2sebelum = false; L2_click = false; } - + + if (LY < 100 && LY > 50) { + if ( LYpSebelum) { LYp_click = false; + } else { LYp_click = true;} + LYpSebelum = true; + }else { LYpSebelum = false; + LYp_click = false; + } + if (LY > 150 && LY < 200) { + if ( LYnSebelum) { LYn_click = false; + } else { LYn_click = true;} + LYnSebelum = true; + }else { LYnSebelum = false; + LYn_click = false; + } segitiga_click = (bool)((button_click >> 0) & 0x1); lingkaran_click = (bool)((button_click >> 1) & 0x1); silang_click = (bool)((button_click >> 2) & 0x1); @@ -130,8 +144,11 @@ RL = 0; button_click = 0; RL_click = 0; - R2_click =0; - L2_click =0; + R2_click = 0; + L2_click = 0; + L3_click = 0; + LYp_click = 0; + LYn_click = 0; R2 = 0; L2 = 0; RX = 0; @@ -183,7 +200,7 @@ } else { idle(); } // Indikator - Print data pada monitor PC - // debug.printf("%2x %2x %2x %2x %3d %3d %3d %3d %3d %3d\n\r",button, RL, button_click, RL_click, R2, L2, RX, RY, LX, LY); + //debug.printf("%2x %2x %2x %2x %3d %3d %3d %3d %3d %3d\n\r",button, RL, button_click, RL_click, R2, L2, RX, RY, LX, LY); } } @@ -200,8 +217,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, R2_click, L2_click; - bool R2sebelum,L2sebelum; + bool L1_click, R1_click, L3_click, R3_click, R2_click, L2_click, LYp_click, LYn_click; + bool R2sebelum, L2sebelum, L3sebelum, LYpSebelum, LYnSebelum; bool START_click, SELECT_click, PS_click; protected:
--- a/PS3Arduino.txt Mon May 15 07:08:30 2017 +0000 +++ b/PS3Arduino.txt Mon May 15 07:49:13 2017 +0000 @@ -45,7 +45,7 @@ boolean START_click=0, SELECT_click=0, PS_click=0; // Deklarasi variabel tombol analog -unsigned char LX, LY, RX, RY, aL2, aR2; +unsigned char LX, LY, RX, RY, aL2, aR2, aL3; // Deklarasi varibel data yang dikirim unsigned char button; @@ -286,8 +286,8 @@ aL2 = PS3.getAnalogButton(L2); aR2 = PS3.getAnalogButton(R2); - - kirimdatajoystik(); + + kirimdatajoystik(); } else { // PS3 Disconnected Serial.write(0x88);
--- a/main.cpp Mon May 15 07:08:30 2017 +0000 +++ b/main.cpp Mon May 15 07:49:13 2017 +0000 @@ -311,10 +311,14 @@ // Power Screw Down caseJoystick = 12; } - else if (joystick.L3){ - // Paku Bumi ON/OFF + else if (joystick.LYp_click) { + // Paku Bumi Naik caseJoystick = 34; } + else if (joystick.LYn_click) { + // Paku Bumi Turun + caseJoystick = 35; + } else { tuneAksel = 0.6; @@ -636,14 +640,19 @@ isReload = true; break; } - case (34) :{ - pneu_paku = !pneu_paku; + case (34) : + { + pneu_paku = 1; + // Paku Bumi Naik wait_ms(50); - if (pneu_paku == 1){ - PIVOT = 0.17; - }else{ - PIVOT = 0.8; - } + PIVOT = 0.17; + } + case (35) : + { + // Paku Bumi Turun + pneu_paku = 0; + wait_ms(50); + PIVOT = 0.8; } default : {