2015/05/16
Dependencies: ADXL345 AigamozuControlPackets HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST mbed
Fork of Aigamozu_Robot_ver3_1 by
Revision 14:5deb7a4f1cd4, committed 2015-05-14
- Comitter:
- s1200058
- Date:
- Thu May 14 12:26:14 2015 +0000
- Parent:
- 13:bbec1926a3d2
- Child:
- 15:f3d01f37f00d
- Commit message:
- 2015/05/14
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu May 14 12:09:22 2015 +0000
+++ b/main.cpp Thu May 14 12:26:14 2015 +0000
@@ -385,6 +385,11 @@
int count = 0;
myGPS.begin(GPS_BAUD_RATE);
+ Timer collect_Timer;
+ const int collect_Time = 2000; //when we collect 4 GPS point, we use
+ int collect_flag = 0;
+ char collect_state = 'a';
+
char SenderIDc;
//GPS Send Command
myGPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
@@ -463,8 +468,29 @@
Get_GPS(&myGPS);
}
+
+ //get base GPS
+ if( collect_Timer.read_ms() >= collect_Time){
+ collect_Timer.reset();
+
+ //printf("Send Request:%d,%d\n",collect_flag,collect_state);
+
+ agz.createRequestCommand(MyID, collect_state);
+ //Select Destination
+ ZBTxRequest tx64request(base_Address[collect_flag],agz.packetData,agz.getPacketLength());
+ //Send -> Base
+ xbee.send(tx64request);
+
+ collect_flag++;
+ collect_state++;
+
+ if(collect_flag == 4){
+ collect_state = 'a';
+ collect_flag = 0;
+ }
+ }
- if(agz.nowMode == AUTO_MODE && auto_Timer.read_ms() >= auto_Time){
+ if(agz.nowMode == AUTO_GPS_MODE && auto_Timer.read_ms() >= auto_Time){
auto_Timer.reset();
auto_Move();
}
