Hi,
I am using Xbee pro series1 with Arduino UNO for communication. I am using the broadcast mode in API mode and Arduino Xbee library. The transmission from Co-ordinator is taking place but the packets are not being received . Can anyone tell what is error in the receiver code?
This is my code:
#include <XBee.h>
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
Rx64Response rx64 = Rx64Response();
void setup() {
Serial.begin(9600);
xbee.setSerial(Serial);
}
void loop() {
String sample;
xbee.readPacket();
if (xbee.getResponse().isAvailable()) {
Serial.println("packet available");
Serial.println(xbee.getResponse().getApiId());
if (xbee.getResponse().getApiId() == RX_64_RESPONSE) {
xbee.getResponse().getRx64Response(rx64);
for (int i = 0; i < rx64.getDataLength(); i++) {
sample += (char)rx64.getData(i);
}
Serial.println(sample);
}
}else if (xbee.getResponse().isError()) {
Serial.println("Error reading packet. Error code: ");
Serial.println(xbee.getResponse().getErrorCode());
}
delay(100);
}
Thank you for your time,
Lucy