Hello--
I have two Series 1 Xbee's connected to Arduino Uno's via a Sparkfun Xbee Shield. I am attempting to get the two to communicate. I have my router (end device; PAN ID: 3332, DH: 13A200, DL:4124935F (NOTE:These are the serial values for my coordinator), MY: FFFE) connected to the Arduino, and the Arduino has the following code uploaded on it:
#include <XBee.h>
#include <AltSoftSerial.h>
XBeeWithCallbacks xbee;
AltSoftSerial SoftSerial;
#define DebugSerial Serial
#define XBeeSerial SoftSerial
void setup() {
// Setup debug serial output
DebugSerial.begin(115200);
DebugSerial.println(F("Starting..."));
// Setup XBee serial communication
XBeeSerial.begin(9600);
xbee.begin(XBeeSerial);
delay(1);
// Send a first packet right away
sendPacket();
}
void sendPacket() {
// Prepare the Zigbee Transmit Request API packet
ZBTxRequest tx64Request;
tx64Request.setAddress64(0x000000000000000);
uint8_t payload[] = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!'};
tx64Request.setPayload(payload, sizeof(payload));
// And send it
uint8_t status = xbee.sendAndWait(tx64Request, 5000);
if (status == 0) {
DebugSerial.println(F("Succesfully sent packet"));
} else {
DebugSerial.print(F("Failed to send packet. Status: 0x"));
DebugSerial.println(status, HEX);
}
}
unsigned long last_tx_time = 0;
void loop() {
// Check the serial port to see if there is a new packet available
xbee.loop();
// Send a packet every 10 seconds
if (millis() - last_tx_time > 10000) {
last_tx_time = millis();
sendPacket();
}
}
My Coordinator Xbee (PAN ID: 3332, DH: 0, DL: 0, MY: FFFE)is connected to another Arduino. When I look at the serial output for my router Arduino, I get the following error:
Failed to send packet. Status: 0xFF
I think this error message indicates that there was nothing received. I am confused by this because the Association LED on both of my shields blinks when they are powered, indicating that they have found each other on the network, correct?
The code I am using was modified slightly to be used with a Series 1 (it was originally written to be used with Series 2). I think there might be something I am overlooking in the code....
Any help or suggestions would be really helpful. Thanks!