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.
Dependencies: VNH5019
Dependents: Aigamozu_Robot_展示会 Aigamozu_Robot_March Aigamozu_Robot_templete
Fork of AigamozuControlPackets by
Diff: AigamozuControlPackets.cpp
- Revision:
- 52:d4d739f01b38
- Parent:
- 51:67f01969f709
diff -r 67f01969f709 -r d4d739f01b38 AigamozuControlPackets.cpp --- a/AigamozuControlPackets.cpp Fri Mar 31 06:26:28 2017 +0000 +++ b/AigamozuControlPackets.cpp Thu Apr 20 10:24:16 2017 +0000 @@ -3,12 +3,13 @@ #define LOW_SPEED 16 #define HIGH_SPEED 64 -#define FORWARD_SPEED 64 +#define FORWARD_SPEED 32 ////////////////////////////// // Init // ////////////////////////////// AigamozuControlPackets::AigamozuControlPackets(VNH5019 agzSheild):_agzSheild(agzSheild){ + packetData = new uint8_t[50]; } ////////////////////////////// @@ -33,8 +34,17 @@ manualCount =0; _agzSheild.changeSpeed(buf[20],buf[21],buf[23],buf[24]); } - } +} + + + void AigamozuControlPackets::createChangeModeCommand(uint8_t fromID,uint8_t toID,int mode){ + uint8_t tmp[] = {'A','G','S','C','F',fromID,'T',toID,(uint8_t)mode,'A','G','E'}; + for(int i = 0; i < CHANGE_MODE_COMMAND_LENGTH; ++i) packetData[i] = tmp[i]; + packetLength = CHANGE_MODE_COMMAND_LENGTH; +} + + /////////////////////////////////////// // each mode interrupt // /////////////////////////////////////// @@ -63,11 +73,11 @@ if(nowMode == AUTO_GPS_MODE){ - if(moveTimer.read_ms() <= 400){ - _agzSheild.changeSpeed(1,HIGH_SPEED,0,LOW_SPEED);//時計回り - }else if(moveTimer.read_ms() > 400 && moveTimer.read_ms() <= 500){ - _agzSheild.changeSpeed(0,LOW_SPEED,0,LOW_SPEED); //反時計回り - } + //if(moveTimer.read_ms() <= 400){ + _agzSheild.changeSpeed(1,FORWARD_SPEED,1,FORWARD_SPEED); + //}else if(moveTimer.read_ms() > 400 && moveTimer.read_ms() <= 500){ + // _agzSheild.changeSpeed(0,LOW_SPEED,0,LOW_SPEED); //stop + //} } return 1;