Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CRAC-Strat_copy by
Diff: Asservissement/Asservissement.cpp
- Revision:
- 12:14729d584500
- Parent:
- 11:ed13a480ddca
- Child:
- 14:c8fc06c4887f
--- a/Asservissement/Asservissement.cpp Mon May 02 19:40:59 2016 +0000 +++ b/Asservissement/Asservissement.cpp Mon May 09 09:10:17 2016 +0000 @@ -156,3 +156,40 @@ can1.write(msgTx); } + +/****************************************************************************************/ +/* FUNCTION NAME: setAsservissementEtat */ +/* DESCRIPTION : Activer ou désactiver l'asservissement */ +/****************************************************************************************/ +void setAsservissementEtat(unsigned char enable) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=ASSERVISSEMENT_ENABLE; // Tx rotation autour du centre du robot + msgTx.len=1; + msgTx.format=CANStandard; + msgTx.type=CANData; + // Angle signé sur 2 octets + msgTx.data[0]=(unsigned char)((enable==0)?0:1); + + can1.write(msgTx); +} + + +/****************************************************************************************/ +/* FUNCTION NAME: SendSpeed */ +/* DESCRIPTION : Envoie un asservissement paramètre retournant à une vitesse */ +/****************************************************************************************/ +void SendSpeed (unsigned short vitesse, unsigned short acceleration) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=ASSERVISSEMENT_CONFIG; + msgTx.format=CANStandard; + msgTx.type=CANData; + msgTx.len=4; + msgTx.data[0]=(unsigned char)(vitesse&0x00FF); + msgTx.data[1]=(unsigned char)((vitesse&0xFF00)>>8); + msgTx.data[2]=(unsigned char)(acceleration&0x00FF); + msgTx.data[3]=(unsigned char)((acceleration&0xFF00)>>8); + + can1.write(msgTx); +} \ No newline at end of file