I have finalized the design for the first GPS tracker that I will attach to the AR.Drone. I wrote a simple program that builds a string containing the date, time, latitude, longitude, heading, and speed. This data is then sent through the XBee using API mode. A second program on the base station Arduino receives the packet through the XBee and extracts the payload. The program then echos the data to the serial port where it will be picked up by the Java program running on the Mac-mini. The program will then record the data for playback on Google Earth.
Transmitter Code
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40703ea9);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();
TinyGPS gps;
SoftwareSerial nss(3,4);
void setup() {
pinMode(statusLed, OUTPUT);
pinMode(errorLed, OUTPUT);
xbee.begin(9600);
nss.begin(4800);
}
void loop() {
...
if (age != TinyGPS::GPS_INVALID_AGE) {
sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d %s %s %s %s", month, day, year, hour, minute, second, latChar, longChar, altChar, spdChar);
}
for(int cnt=0; cnt < 55; cnt++) {
payload[cnt] = sz[cnt];
}
zbTx.setPayload(payload);
xbee.send(zbTx);
...
}
Receiver Code
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
// create reusable response objects for responses we expect to handle
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();
....
void loop() {
xbee.readPacket();
for(int cnt=0; cnt < 55; cnt++) {
Serial.print((char)rx.getData(cnt));
}
...
}