![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
code asli
Dependencies: mbed Servo encoderKRTMI Motornew Lengan3 millis
Diff: main.cpp
- Revision:
- 3:6d469c371f49
- Parent:
- 2:ab055f0284fc
diff -r ab055f0284fc -r 6d469c371f49 main.cpp --- a/main.cpp Sun Feb 24 09:45:32 2019 +0000 +++ b/main.cpp Sun May 19 15:59:31 2019 +0000 @@ -5,9 +5,8 @@ joysticknucleo joystick(PA_0,PA_1); Serial pc(USBTX,USBRX); /* Deklarasi Motor Base */ -Motor motorDepan(PB_7, PC_3, PC_0); //(PB_9, PA_12, PC_5); -Motor motorKanan(PB_3, PA_10, PC_4); -Motor motorKiri (PB_9, PA_6, PA_12); +Motor motorKanan(PA_15, PB_0, PA_4); +Motor motorKiri (PB_7, PC_2, PC_3); int case_joy; /****************************************************/ /* Deklarasi Fungsi dan Procedure */ @@ -34,7 +33,7 @@ caseJoystick = 2; } else if ((!joystick.R1)&&(!joystick.L1)&&(joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(!joystick.kiri)) { - // Pivot Kiri + // Maju caseJoystick = 3; } else if ((!joystick.R1)&&(!joystick.L1)&&(!joystick.atas)&&(!joystick.bawah)&&(!joystick.kanan)&&(joystick.kiri)) { @@ -59,54 +58,47 @@ case (1): { // Pivot Kanan - motorDepan.speed(0.23); - motorKanan.speed(0.17); - motorKiri.speed(0.23); + motorKanan.speed(0.3); + motorKiri.speed(0.4); break; } case (2): { // Pivot Kiri - motorDepan.speed(-0.23); - motorKanan.speed(-0.17); - motorKiri.speed(-0.23); + motorKanan.speed(-0.3); + motorKiri.speed(-0.4); break; } case (3): { // Maju - motorDepan.speed(0); - motorKanan.speed(-0.17); - motorKiri.speed(0.3); + motorKanan.speed(-0.5); + motorKiri.speed(0.5); break; } case (4): { // Kiri - motorDepan.speed(-0.23); - motorKanan.speed(0.17); - motorKiri.speed(0.3); + motorKanan.speed(0.5); + motorKiri.speed(0.6); break; } case (5): { //Belakang - motorDepan.speed(0); - motorKanan.speed(0.17); - motorKiri.speed(-0.3); + motorKanan.speed(0.3); + motorKiri.speed(-0.4); break; } case (6): { // Kanan - motorDepan.speed(0.23); - motorKanan.speed(-0.17); - motorKiri.speed(-0.3); + motorKanan.speed(-0.3); + motorKiri.speed(-0.4); break; } default : { - motorDepan.brake(1); motorKanan.brake(1); motorKiri.brake(1); } @@ -154,4 +146,5 @@ // previousMillis5 = millis(); // } - } \ No newline at end of file + } +} \ No newline at end of file