![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
on Motor
Dependencies: encoderKRAI mbed Motor_new
Revision 11:38e621509cdc, committed 2019-08-08
- Comitter:
- oktavianusirvan
- Date:
- Thu Aug 08 12:18:35 2019 +0000
- Parent:
- 10:95e41bc4252c
- Commit message:
- ini codenya;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 95e41bc4252c -r 38e621509cdc main.cpp --- a/main.cpp Sun May 19 20:06:39 2019 +0000 +++ b/main.cpp Thu Aug 08 12:18:35 2019 +0000 @@ -1,16 +1,17 @@ // -// #include <Motor.h> #include <encoderKRAI.h> #include <mbed.h> // declare -Motor main_motor(PB_15, PB_14, PB_13 ); // input pin +Motor main_motor(PA_7, PA_5, PA_6 );// input pin +Motor main_motorB(PB_0 ,PC_0, PC_1); //input pin +Motor main_motorC(PB_1, PB_14, PB_15 );// input pin DigitalOut pneu(PC_6);// input pin DigitalOut pneu1(PC_5);// input pin DigitalOut pneu2(PC_8);// input pin DigitalIn infrared(PB_12, PullUp); // input pin -encoderKRAI encoder(PB_2,PB_1,538,encoderKRAI::X4_ENCODING);// input pin +encoderKRAI encoder(PC_2,PC_3,538,encoderKRAI::X4_ENCODING);// input pin Serial pc(USBTX, USBRX,115200); int count, count_ball ; @@ -27,7 +28,9 @@ total_pulse += pulse; total_pulse_in_degree = total_pulse*360/538; } - + + + void PID(double theta){ //pid galat = theta - total_pulse_in_degree; @@ -81,6 +84,14 @@ int t1; int main(){ + encoder.reset(); + while (1){ + //MoveMotor(3600); + main_motor.speed(0.5); + main_motorB.speed(0.5); + main_motorC.speed(0.5); + } + /* pneu = 1; encoder.reset(); int state = 1; @@ -108,5 +119,5 @@ } if (count_ball==6) pneu = 1; - } + }*/ }