Hey guys,
I need your help. I’m trying to hook a XBee radio to Particle. I have a working code from arduino and am connecting it as i will connect it on my arduino. I’m configuring the particle XBee as router in API mode 2. i’m sending a packet from XBee coordinator which shows a successful delivery. but at the RX side i get false on checking if the XBee radio received any packet. All the XBee are on same pan id and same firmware. I’m attaching the code also for reference. The coordinator is generating frame from XCTU software. dependencies.XBee=0.0.10 - >Xbee library i’m using for photon
Code RX:
#include <XBee.h>
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
ZBRxResponse rx = ZBRxResponse();
void setup() {
Serial.begin(9600);
xbee.begin(Serial);
}
void loop() {
String sample;
xbee.readPacket();
if (xbee.getResponse().isAvailable()) { // -> statement returning false
Serial.println(xbee.getResponse().getApiId());
if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
xbee.getResponse().getZBRxResponse(rx);
for (int i = 0; i < rx.getDataLength(); i++) {
sample += (char)rx.getData(i);
}
Serial.println(sample);
}
}else if (xbee.getResponse().isError()) {
Serial.println("Error reading packet. Error code: ");
Serial.println(xbee.getResponse().getErrorCode());
}
delay(100);
}