Robot's source code
Dependencies: mbed
Diff: main.cpp
- Revision:
- 25:c5773b021bb0
- Parent:
- 24:3c0422e1ebd6
--- a/main.cpp Thu Jan 15 15:58:25 2015 +0000 +++ b/main.cpp Tue Jan 20 14:34:23 2015 +0000 @@ -21,39 +21,20 @@ /*---------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------*/ - /*Serial*/ - Serial pcs(USBTX, USBRX); // tx, rx +/*Serial*/ +Serial pcs(USBTX, USBRX); // tx, rx /*----------------------------------------------------------------------------------------------*/ /* --- Initialisation de la liste des obstable --- */ int Obstacle::lastId = 0; +DigitalOut myled(LED1); + int main() { - pcs.printf("demarrage"); - //mbed - /* - PwmOut pw1(p22); - DigitalOut dir1(p21); - PwmOut pw2(p24); - DigitalOut dir2(p23); - */ + pcs.baud(115200); + pcs.printf("Demarrage.\n"); - //mbuino - /* - PwmOut pw1(P0_17); - DigitalOut dir1(P0_18); - PwmOut pw2(P0_23); - DigitalOut dir2(P0_19); - */ - /* - //nucleo - PwmOut pw1(PB_8); - DigitalOut dir1(D12); - PwmOut pw2(PB_9); - DigitalOut dir2(D13); - */ - //nucleo PwmOut pw1(PA_0); DigitalOut dir1(PB_8); PwmOut pw2(PA_1); @@ -64,24 +45,18 @@ dir1.write(0); dir2.write(0); + pw1.write(0.0); + pw2.write(0.0); + pcs.printf("Mise a jour des pwm.\n"); - pw1.write(0.1); - pw2.write(0.8); - //setPWM(&pw1,0.9); - pcs.printf("mise a jour des pwm.\n"); - - //while(1); /*----------------------------------------------------------------------------------------------*/ /*Odometry*/ - //QEI qei_left(p15,p16,NC,1024*reduc,QEI::X4_ENCODING); - //QEI qei_left(P0_2,P0_7,NC,1024*reduc,QEI::X4_ENCODING);//mbuino - //QEI qei_left(PA_3,PA_2,NC,1024*reduc,QEI::X4_ENCODING);//nucleo - - //QEI qei_right(p17,p18,NC,1024*reduc,QEI::X4_ENCODING); - //QEI qei_right(P0_8,P0_20,NC,1024*reduc,QEI::X4_ENCODING);//mbuino - //QEI qei_right(PA_10,PB_3,NC,1024*reduc,QEI::X4_ENCODING);//nucleo - - //Odometry odometry(&qei_left,&qei_right,0.07,0.07,0.26); + pcs.printf("Init QEI Right.\n"); + QEI qei_right(D2,D3,NC,1024,QEI::X4_ENCODING); + pcs.printf("Init QEI Left.\n"); + QEI qei_left(D4,D5,NC,1024,QEI::X4_ENCODING); + pcs.printf("Init Odometry.\n"); + Odometry odometry(&qei_left,&qei_right,0.07,0.07,0.26); /*----------------------------------------------------------------------------------------------*/