ARES
/
Timer
Time is good
Fork of Robot2016_2-0 by
main.cpp@48:03da1aead032, 2016-04-28 (annotated)
- Committer:
- sype
- Date:
- Thu Apr 28 08:11:25 2016 +0000
- Revision:
- 48:03da1aead032
- Parent:
- 46:5658af4e5149
- Child:
- 49:5e2f7323f280
Int?gration de "l'algo" carte boutons, maintenant le bouton bleu (utilisateur) est remplac? par le jumper pr?sent sur la carte (on le retire pour d?marrer) et le changement de camp du robot se fait par le bouton pr?sent sur cette carte
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sype | 41:b5a2fbc20beb | 1 | #include "func.h" |
sype | 0:ad9600df4a70 | 2 | |
sype | 41:b5a2fbc20beb | 3 | /* Déclaration des différents éléments de l'IHM */ |
sype | 46:5658af4e5149 | 4 | |
sype | 48:03da1aead032 | 5 | InterruptIn CAMP(PA_15); |
sype | 48:03da1aead032 | 6 | InterruptIn START(PB_7); |
sype | 46:5658af4e5149 | 7 | DigitalOut LEDR(PC_2); |
sype | 46:5658af4e5149 | 8 | DigitalOut LEDV(PC_3); |
sype | 46:5658af4e5149 | 9 | |
sype | 10:ae3178aa94e9 | 10 | InterruptIn mybutton(USER_BUTTON); |
sype | 10:ae3178aa94e9 | 11 | DigitalIn button(USER_BUTTON); |
sype | 46:5658af4e5149 | 12 | |
sype | 46:5658af4e5149 | 13 | DigitalIn ChannelA1(PA_1); |
sype | 46:5658af4e5149 | 14 | DigitalIn ChannelB1(PA_0); |
sype | 46:5658af4e5149 | 15 | DigitalIn ChannelA2(PA_5); |
sype | 46:5658af4e5149 | 16 | DigitalIn ChannelB2(PA_6); |
sype | 46:5658af4e5149 | 17 | |
sype | 41:b5a2fbc20beb | 18 | DigitalOut bleu(PC_5); |
sype | 41:b5a2fbc20beb | 19 | DigitalOut blanc(PC_6); |
sype | 41:b5a2fbc20beb | 20 | DigitalOut rouge(PC_8); |
sype | 41:b5a2fbc20beb | 21 | |
sype | 46:5658af4e5149 | 22 | /* AX12 - non fonctionnels, je pense que le souci vient de la bibliothèque car la trame n'est pas correcte (analyseur logique) */ |
sype | 48:03da1aead032 | 23 | //AX12 left_hand(PA_9, PA_10, 4, 250000); |
sype | 48:03da1aead032 | 24 | //AX12 right_hand(PA_9, PA_10, 1, 250000); |
sype | 41:b5a2fbc20beb | 25 | |
sype | 41:b5a2fbc20beb | 26 | /* Sharp */ |
sype | 41:b5a2fbc20beb | 27 | AnalogIn capt1(PA_4); |
sype | 41:b5a2fbc20beb | 28 | AnalogIn capt2(PB_0); |
sype | 41:b5a2fbc20beb | 29 | AnalogIn capt3(PC_1); |
sype | 41:b5a2fbc20beb | 30 | AnalogIn capt4(PC_0); |
sype | 41:b5a2fbc20beb | 31 | |
sype | 41:b5a2fbc20beb | 32 | /* Moteurs pas à pas */ |
sype | 46:5658af4e5149 | 33 | Stepper RMot(NC, PA_8, PC_7); |
sype | 46:5658af4e5149 | 34 | Stepper ZMot(NC, PB_4, PB_10); |
sype | 46:5658af4e5149 | 35 | Stepper LMot(NC, PB_5, PB_3); |
sype | 41:b5a2fbc20beb | 36 | /* Fins de course */ |
sype | 41:b5a2fbc20beb | 37 | InterruptIn EndR(PB_15); |
sype | 41:b5a2fbc20beb | 38 | InterruptIn EndZ(PB_14); |
sype | 41:b5a2fbc20beb | 39 | InterruptIn EndL(PB_13); |
sype | 41:b5a2fbc20beb | 40 | |
sype | 0:ad9600df4a70 | 41 | Ticker ticker; |
sype | 41:b5a2fbc20beb | 42 | |
sype | 41:b5a2fbc20beb | 43 | Serial logger(USBTX, USBRX); |
sype | 48:03da1aead032 | 44 | //Serial logger(PA_9, PA_10); |
sype | 46:5658af4e5149 | 45 | RoboClaw roboclaw(ADR, 460800, PA_11, PA_12); |
IceTeam | 39:309f38d1e49c | 46 | Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw); |
sype | 10:ae3178aa94e9 | 47 | |
sype | 48:03da1aead032 | 48 | int SIMON_i = 0, SIMON_state = 0, SCouleur = 1, SStart = 0; |
sype | 46:5658af4e5149 | 49 | bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false; |
sype | 0:ad9600df4a70 | 50 | |
sype | 2:abdf8c6823a1 | 51 | void init(void); |
sype | 46:5658af4e5149 | 52 | void update_main(void); |
sype | 0:ad9600df4a70 | 53 | |
sype | 43:d5aaff7d2bec | 54 | /* Debut du programme */ |
sype | 0:ad9600df4a70 | 55 | int main(void) |
sype | 10:ae3178aa94e9 | 56 | { |
sype | 37:da3a2c781672 | 57 | init(); |
sype | 48:03da1aead032 | 58 | while(1); |
sype | 2:abdf8c6823a1 | 59 | } |
sype | 2:abdf8c6823a1 | 60 | |
sype | 2:abdf8c6823a1 | 61 | void init(void) |
sype | 0:ad9600df4a70 | 62 | { |
sype | 37:da3a2c781672 | 63 | logger.baud(9600); |
sype | 48:03da1aead032 | 64 | logger.printf("Coucou!\n\r"); |
sype | 46:5658af4e5149 | 65 | roboclaw.ForwardM1(0); |
sype | 46:5658af4e5149 | 66 | roboclaw.ForwardM2(0); |
sype | 48:03da1aead032 | 67 | while(SStart==0); |
sype | 48:03da1aead032 | 68 | wait(1); |
sype | 48:03da1aead032 | 69 | odo.setPos(110, 1000, 0); |
sype | 46:5658af4e5149 | 70 | roboclaw.ResetEnc(); |
sype | 44:b1fd7489369f | 71 | init_interrupt(); |
sype | 41:b5a2fbc20beb | 72 | wait_ms(100); |
IceTeam | 39:309f38d1e49c | 73 | logger.printf("End init\n\r"); |
sype | 0:ad9600df4a70 | 74 | } |
sype | 46:5658af4e5149 | 75 | |
sype | 46:5658af4e5149 | 76 | void update_main(void) |
sype | 46:5658af4e5149 | 77 | { |
sype | 48:03da1aead032 | 78 | //odo.update_odo(); |
sype | 46:5658af4e5149 | 79 | //checkAround(); |
sype | 46:5658af4e5149 | 80 | } |