bug : pwm full di launcher
Dependencies: Motor PID Joystick_OrdoV5 mbed millis
Fork of MainProgram_BaseBaru by
Diff: main.cpp
- Revision:
- 28:2d0746dc2d7d
- Parent:
- 27:68efb1622985
- Child:
- 29:7b372b0aaa61
--- a/main.cpp Fri Feb 10 17:59:57 2017 +0000 +++ b/main.cpp Fri Feb 10 19:18:55 2017 +0000 @@ -77,8 +77,8 @@ encoderKRAI encoderKiri(PC_4, PB_15, 2000, encoderKRAI::X2_ENCODING); //inA, inB, pin Indeks (NC = tak ada), resolusi, pembacaan /* Deklarasi Encoder Launcher */ -encoderKRAI encoderAtas( PB_13, PB_14, 14, encoderKRAI::X2_ENCODING); -encoderKRAI encoderAtas2( PB_15, PC_4, 14, encoderKRAI::X2_ENCODING); +encoderKRAI encoderAtas( PB_13, PB_14, 28, encoderKRAI::X2_ENCODING); +encoderKRAI encoderAtas2( PB_15, PC_4, 28, encoderKRAI::X2_ENCODING); /* Deklarasi Motor Base */ Motor motor1(PB_9, PC_5, PA_12); // pwm, fwd, rev, Motor Depan @@ -97,10 +97,6 @@ DigitalIn limitT(PB_10, PullUp); DigitalIn limitB (PC_8, PullUp); -/* Deklarasi Servo */ -//Servo servoS(PB_2); -//Servo servoB(PA_5); - /** * posX dan posY berdasarkan arah robot * encoder Depan & Belakang sejajar sumbu Y @@ -198,11 +194,14 @@ } reload = !reload; } + /*Motor Atas*/ if (launcher) { startMillis(); - currentMillis = millis(); - /*Launcher Depan*/ + currentMillis = millis(); + currentMillis2 = millis(); + + /*PID Launcher Depan*/ if (currentMillis-previousMillis>=10) { rpm = (float)encoderAtas.getPulses(); @@ -244,6 +243,7 @@ encoderAtas2.getPulses(); } } + // MOTOR Bawah switch (case_ger) { case (1): { @@ -366,7 +366,9 @@ pneumatik = 0; } speedKalibrasiMotor(); - if (joystick.silang_click) reload = !reload; + if (joystick.silang_click){ + reload = !reload; + } } else { joystick.idle(); @@ -374,4 +376,4 @@ motor2.brake(1); } } -} +} \ No newline at end of file