![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
pixy info2
Dependencies: CMPS03 SRF05 mbed pixy
Fork of 0000Non_stop_code_v3 by
globals.cpp@0:a8cee96c9250, 2017-06-10 (annotated)
- Committer:
- pirottealex
- Date:
- Sat Jun 10 04:58:21 2017 +0000
- Revision:
- 0:a8cee96c9250
- Child:
- 1:99f469d63b9a
rrrr
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); |
pirottealex | 0:a8cee96c9250 | 18 | CMPS03 Boussole(p9,p10,0xC0); |
pirottealex | 0:a8cee96c9250 | 19 | I2C monI2C(p9,p10); |
pirottealex | 0:a8cee96c9250 | 20 | PwmOut Servo(p21); |
pirottealex | 0:a8cee96c9250 | 21 | |
pirottealex | 0:a8cee96c9250 | 22 | AnalogIn SD_1(p19); // capteur de distance courte droite |
pirottealex | 0:a8cee96c9250 | 23 | AnalogIn SD_2(p20); // capteur de distance courte gauche |
pirottealex | 0:a8cee96c9250 | 24 | AnalogIn LD_1(p17); // capteur de distance longue droite |
pirottealex | 0:a8cee96c9250 | 25 | AnalogIn LD_2(p18); // capteur de distance longue gauche |
pirottealex | 0:a8cee96c9250 | 26 | |
pirottealex | 0:a8cee96c9250 | 27 | InterruptIn I_D(p30); |
pirottealex | 0:a8cee96c9250 | 28 | InterruptIn I_G(p29); |
pirottealex | 0:a8cee96c9250 | 29 | |
pirottealex | 0:a8cee96c9250 | 30 | SPI spi(p5,p6,p7); |
pirottealex | 0:a8cee96c9250 | 31 | |
pirottealex | 0:a8cee96c9250 | 32 | AnalogIn C1(p15);// capteur de ligne blanche 1 |
pirottealex | 0:a8cee96c9250 | 33 | AnalogIn C3(p16);// capteur de ligne blanche 3 |
pirottealex | 0:a8cee96c9250 | 34 | //-- le capteur de ligne 2 est sur un MCP3201(spi) dont le CS est sur p13 |
pirottealex | 0:a8cee96c9250 | 35 | |
pirottealex | 0:a8cee96c9250 | 36 | DigitalIn bp(p14); |
pirottealex | 0:a8cee96c9250 | 37 | DigitalOut cs(p13); |
pirottealex | 0:a8cee96c9250 | 38 | |
pirottealex | 0:a8cee96c9250 | 39 | |
pirottealex | 0:a8cee96c9250 | 40 | int j=0,etat=0; |
pirottealex | 0:a8cee96c9250 | 41 | uint16_t blocks; |
pirottealex | 0:a8cee96c9250 | 42 | float taille,errorX,gBoussole,cap_set,cap_rot; |
pirottealex | 0:a8cee96c9250 | 43 | int captL1,bout; |
pirottealex | 0:a8cee96c9250 | 44 | int captL3; |
pirottealex | 0:a8cee96c9250 | 45 | float us_arriere; |
pirottealex | 0:a8cee96c9250 | 46 | Timer tempo; |