Update 18 Februari 2017, PID laucnher dan Base sudah diperbarui
Dependencies: Motor PID Joystick_OrdoV5 mbed millis
Fork of MainProgram_BaseBaru_otomatis-reloader by
Diff: main.cpp
- Revision:
- 24:b3e632cc4533
- Parent:
- 23:023b522977b2
- Child:
- 25:054d3048dd03
diff -r 023b522977b2 -r b3e632cc4533 main.cpp --- a/main.cpp Wed Feb 01 15:00:08 2017 +0000 +++ b/main.cpp Thu Feb 02 11:12:43 2017 +0000 @@ -27,8 +27,10 @@ /* Tombol lingkaran=> Aktif servo Launcher */ /* Tombol L1 => Pivot Kiri */ /* Tombol R1 => Pivot Kanan */ -/* Tombol L3 => PWM Launcher Belakang dikurangin */ -/* Tombol R3 => PWM Launcher Belakang ditambahin */ +/* Tombol L3 => PWM Motor Belakang Dikurangi */ +/* Tombol R3 => PWM Motor Belakang Ditambah */ +/* Tombol L2 => PWM Motor Depan Dikurangi */ +/* Tombol R2 => PWM Motor Depan Ditambah */ /* */ /* Bismillahirahmanirrahim */ /* Jagalah Kebersihan Kodingan */ @@ -184,13 +186,13 @@ case (3) : { // Kanan motor1.speed(-VMAX-vpid); - motor2.speed(VMAX+vpid); + motor2.speed(0.2+vpid); break; } case (4) : { // Kiri motor1.speed(VMAX-vpid); - motor2.speed(-VMAX+vpid); + motor2.speed(-0.2+vpid); break; } default : { @@ -233,7 +235,7 @@ } } -void speedLauncher(){ +void speedKalibrasiMotor(){ /* Fungsi untuk speed launcher */ if (joystick.R3_click and speedL < 0.8){ speedL = speedL + 0.01; // PWM++ Motor Belakang @@ -246,7 +248,8 @@ } if (joystick.L2_click and speedB > 0.1 ){ speedB = speedB - 0.01; // PWM-- Motor Depan - } + } + // pc.printf("Pwm depan = %.3f\t Pwm belakang = %.3f\n", speedL, speedB); } /*********************************************************/ @@ -283,7 +286,7 @@ if (joystick.segitiga_click) launcher = !launcher; if (joystick.lingkaran_click) servoGo = true; - speedLauncher(); + speedKalibrasiMotor(); } else { joystick.idle();