Programme carte strategie (disco)
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Diff: Robots/Strategie_small.cpp
- Revision:
- 34:6aa4b46b102e
- Parent:
- 30:a1e37af4bbde
- Child:
- 36:6dd30780bd8e
--- a/Robots/Strategie_small.cpp Wed Apr 25 12:42:50 2018 +0000 +++ b/Robots/Strategie_small.cpp Thu Apr 26 20:14:18 2018 +0000 @@ -37,8 +37,11 @@ /* FUNCTION NAME: doAction */ /* DESCRIPTION : Effectuer une action specifique */ /****************************************************************************************/ -unsigned char doAction(unsigned char id, unsigned short cote, short arg2) { +unsigned char doAction(unsigned char id, unsigned short arg1, short arg2) { int retour = 1; + CANMessage msgTx=CANMessage(); + msgTx.format=CANStandard; + msgTx.type=CANData; switch(id) { case 101: //baisser attrape bloc avant SendRawId(BAISSER_ATTRAPE_BLOC); @@ -68,7 +71,11 @@ SendRawId(BLOCAGE_BALLE); break; case 133: //lance le pwm de tir - SendRawId(LANCEMENT_MOTEUR_TIR_ON); + msgTx.id=LANCEMENT_MOTEUR_TIR_ON; + + msgTx.len=1; + msgTx.data[0]=arg1; + can2.write(msgTx); break; case 134: ///Arrete le pwm de tir SendRawId(LANCEMENT_MOTEUR_TIR_OFF); @@ -85,6 +92,10 @@ case 138://position aiguilleur au centre SendRawId(TRI_BALLE); break; + case 139: + SendRawId(VIBRO); + break; + case 200 : @@ -113,24 +124,24 @@ setAsservissementEtat(1); break; - /*case 22://Changer la vitesse du robot - SendSpeed(speed,(unsigned short)angle); + case 22://Changer la vitesse du robot + SendSpeed(arg1,(unsigned short)arg2); wait_us(200); waitingAckFrom = 0; waitingAckID = 0; break; case 19: // CHANGER LA VITESSE + DECELERATION - SendSpeedDecel(speed,(unsigned short) angle); + SendSpeedDecel(arg1,(unsigned short) arg2); wait_us(200); waitingAckFrom = 0; waitingAckID =0; break; case 30://Action tempo - wait_ms(speed); + wait_ms(arg1); break; - */ + default: retour = 0;//L'action n'existe pas, il faut utiliser le CAN