pixy info2
Dependencies: CMPS03 SRF05 mbed pixy
Fork of 0000Non_stop_code_v3 by
globals.cpp@2:48f7e5f79caa, 2017-06-22 (annotated)
- Committer:
- qj604184
- Date:
- Thu Jun 22 09:32:24 2017 +0000
- Revision:
- 2:48f7e5f79caa
- Parent:
- 1:99f469d63b9a
pixy
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pirottealex | 0:a8cee96c9250 | 1 | #include "mbed.h" |
pirottealex | 0:a8cee96c9250 | 2 | #include "SRF05.h" |
pirottealex | 0:a8cee96c9250 | 3 | #include <CMPS03.h> |
pirottealex | 0:a8cee96c9250 | 4 | char cmdI2C=0xF3 ;// CS vbat x x x SensG SensD CS_G CD_D, sens moteur positif CS à 0. |
pirottealex | 0:a8cee96c9250 | 5 | PwmOut MotD(p25); |
pirottealex | 0:a8cee96c9250 | 6 | PwmOut MotG(p22); |
pirottealex | 0:a8cee96c9250 | 7 | |
pirottealex | 0:a8cee96c9250 | 8 | BusOut leds(LED1,LED2,LED3,LED4); |
pirottealex | 0:a8cee96c9250 | 9 | |
pirottealex | 0:a8cee96c9250 | 10 | /*DigitalOut trig1(p11);//US1 |
pirottealex | 0:a8cee96c9250 | 11 | InterruptIn echo1(p12); |
pirottealex | 0:a8cee96c9250 | 12 | DigitalOut trig2(p8);//US2 |
pirottealex | 0:a8cee96c9250 | 13 | InterruptIn echo2(p24); |
pirottealex | 0:a8cee96c9250 | 14 | DigitalOut trig3(p26);//US3 |
pirottealex | 0:a8cee96c9250 | 15 | InterruptIn echo3(p23);*/ |
pirottealex | 0:a8cee96c9250 | 16 | |
pirottealex | 0:a8cee96c9250 | 17 | SRF05 us_arr(p8,p24); |
qj604184 | 2:48f7e5f79caa | 18 | SRF05 us_g(p11,p12); |
qj604184 | 2:48f7e5f79caa | 19 | SRF05 us_d(p26,p23); |
qj604184 | 2:48f7e5f79caa | 20 | |
pirottealex | 0:a8cee96c9250 | 21 | CMPS03 Boussole(p9,p10,0xC0); |
pirottealex | 0:a8cee96c9250 | 22 | I2C monI2C(p9,p10); |
pirottealex | 0:a8cee96c9250 | 23 | PwmOut Servo(p21); |
pirottealex | 0:a8cee96c9250 | 24 | |
pirottealex | 0:a8cee96c9250 | 25 | AnalogIn SD_1(p19); // capteur de distance courte droite |
pirottealex | 0:a8cee96c9250 | 26 | AnalogIn SD_2(p20); // capteur de distance courte gauche |
pirottealex | 0:a8cee96c9250 | 27 | AnalogIn LD_1(p17); // capteur de distance longue droite |
pirottealex | 0:a8cee96c9250 | 28 | AnalogIn LD_2(p18); // capteur de distance longue gauche |
pirottealex | 0:a8cee96c9250 | 29 | |
pirottealex | 0:a8cee96c9250 | 30 | InterruptIn I_D(p30); |
pirottealex | 0:a8cee96c9250 | 31 | InterruptIn I_G(p29); |
pirottealex | 0:a8cee96c9250 | 32 | |
pirottealex | 1:99f469d63b9a | 33 | Timer tempo2; |
pirottealex | 1:99f469d63b9a | 34 | |
pirottealex | 0:a8cee96c9250 | 35 | SPI spi(p5,p6,p7); |
pirottealex | 0:a8cee96c9250 | 36 | |
pirottealex | 0:a8cee96c9250 | 37 | AnalogIn C1(p15);// capteur de ligne blanche 1 |
pirottealex | 0:a8cee96c9250 | 38 | AnalogIn C3(p16);// capteur de ligne blanche 3 |
pirottealex | 0:a8cee96c9250 | 39 | //-- le capteur de ligne 2 est sur un MCP3201(spi) dont le CS est sur p13 |
pirottealex | 0:a8cee96c9250 | 40 | |
pirottealex | 0:a8cee96c9250 | 41 | DigitalIn bp(p14); |
pirottealex | 0:a8cee96c9250 | 42 | DigitalOut cs(p13); |
pirottealex | 0:a8cee96c9250 | 43 | |
pirottealex | 0:a8cee96c9250 | 44 | |
pirottealex | 0:a8cee96c9250 | 45 | int j=0,etat=0; |
pirottealex | 0:a8cee96c9250 | 46 | uint16_t blocks; |
pirottealex | 0:a8cee96c9250 | 47 | float taille,errorX,gBoussole,cap_set,cap_rot; |
pirottealex | 1:99f469d63b9a | 48 | int captL1,bout,flag; |
pirottealex | 0:a8cee96c9250 | 49 | int captL3; |
qj604184 | 2:48f7e5f79caa | 50 | float us_arriere,us_gauche,us_droit,cap_arriere,erreur_ar,erreur_av,cap_avant; |
pirottealex | 0:a8cee96c9250 | 51 | Timer tempo; |