Robot's source code
Dependencies: mbed
Diff: main.cpp
- Revision:
- 37:41abbd7eaec1
- Parent:
- 36:54f86bc6fd80
- Child:
- 38:28f476eacde4
--- a/main.cpp Sun Mar 08 21:24:27 2015 +0000 +++ b/main.cpp Tue Mar 10 17:31:11 2015 +0000 @@ -39,10 +39,10 @@ */ //nucleo - PwmOut pw1(PA_0); - DigitalOut dir1(PB_8); - PwmOut pw2(PA_1); - DigitalOut dir2(PB_9); + PwmOut pw1(PB_13); + DigitalOut dir1(PC_9); + PwmOut pw2(PB_14); + DigitalOut dir2(PB_8); Motor motorR(&pw1,&dir1); @@ -52,9 +52,16 @@ /*----------------------------------------------------------------------------------------------*/ /*Odometry*/ - QEI qei_left(D2,D3,NC,1024*4,QEI::X4_ENCODING); - QEI qei_right(D4,D5,NC,1024*4,QEI::X4_ENCODING); + QEI qei_left(PB_3,PA_10,NC,1024*4,QEI::X4_ENCODING); + QEI qei_right(PB_4,PB_5,NC,1024*4,QEI::X4_ENCODING); Odometry odometry(&qei_left,&qei_right,63/2.,63/2.,280); + DigitalOut led(LED1); + while(1) + { + pcs.printf("x: %f\ty: %f\ttheta: %f\r\n",odometry.getX(),odometry.getY(),odometry.getTheta()); + led = !led; + wait(0.5); + } bool testOdo = true; @@ -96,7 +103,6 @@ } - DigitalOut led(LED1); while(1) { //setPWM(&pw1,0.0);