I'm using AltSoftSerial and the XBee libraries to transmit GPS coordinates. The problem is when I try to transmit: "GPS String" my other Xbee receives a bunch of additional charters:
GPS Stringr~ ÿÿÿþ
I'm not sure why I'm receiving them, but the code is outlined below:
// Xbee - Takes up to 10% of the memory
#include <XBee.h>
//Multi-Serial
#include <AltSoftSerial.h>
//// create the XBee object
XBee xbee = XBee(); //Takes up ~10% of dynamic memory
XBeeAddress64 Broadcast = XBeeAddress64(0x00000000, 0x0000ffff);
////The Serial connection from the Xbee
AltSoftSerial altSerial;
...
// //Setup Serial for Xbee
altSerial.begin(9600);
// //Setup Serial to Xbee - I may be able to live without the xbee object and just use the selectSerial object...
xbee.setSerial(altSerial);
...
sendXbee("GPS String");
...
void sendXbee(const char* command){
ZBTxRequest zbtx = ZBTxRequest(Broadcast, (uint8_t *)command, strlen(command));
xbee.send(zbtx);
}
My best guess is that the sendXbee function is building the transmitted packets incorrectly.
One more side note/question: I've also tried to transmit some gps coordinates and get a bunch of garbage charters too:
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
sendXbee((char)gps.location.lat());
Any help is much appreciated. ![]()
-FlyDangerous o7