Home/Support/Support Forum/xbee.send() does not transmitt anything

xbee.send() does not transmitt anything

0 votes
I use Xbee S2 and arduinoSTM (ARM Based) to communicate module to each other. The coordinator connected to xctu on PC and router to MC. the coordinator send data to the router but the reverse communication does not happen, in fact xbee.send(xbeeTXrequest) does not work.

the code is as follow:

Code:
uint8_t payloadRX[6] = {0};
XBee xbee = XBee();

XBeeAddress64 addCoord = XBeeAddress64(0X0013A200,0X40C8E51F);

ZBTxRequest zBTxReq = ZBTxRequest(addCoord, payloadRX, sizeof(payloadRX));;
ZBTxStatusResponse txStatus = ZBTxStatusResponse();
XBeeResponse response = XBeeResponse();
ZBRxResponse zBRxRes = ZBRxResponse();

void setup()
{
// Set up Serial ports
Serial1.begin(115200);

xbee.begin(Serial1);

flashLed(WorkingLED,3,300);
}

void loop()
{

xbee.readPacket();
if(xbee.getResponse().isAvailable())
{

if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE)
{
xbee.getResponse().getZBRxResponse(zBRxRes);
for (int i = 0; i < zBRxRes.getDataLength(); i++)
{
payloadRX = zBRxRes.getData();
}

if (handleMsg() == FLASH_LED)
{
flashLed(WorkingLED,5,1000);
}



if (handleMsg() == READ_TEMPERATURE)
{
zBTxReq.setPayloadLength(sizeof(payloadRX));
zBTxReq.setPayload(payloadRX);
zBTxReq.setAddress64(addCoord);

zBTxReq = ZBTxRequest(addCoord, payloadRX, sizeof(payloadRX));

xbee.send(zBTxReq);

delay(750);

if(xbee.readPacket(1000))
{
if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE)
{
xbee.getResponse().getZBTxStatusResponse(txStatus);
Serial1.flush();
if (txStatus.getDeliveryStatus() == SUCCESS)
{
flashLed(StatusLED,5,50);
} else
{
flashLed(ErrorLED,3,500);
}
}
} else if (xbee.getResponse().isError())
{
flashLed(ErrorLED, 2, 500);
} else
{
flashLed(ErrorLED, 1, 500);
}
}
} else
{
// not something we were expecting
flashLed(ErrorLED, 1, 25);
}
}
//flashLed(WorkingLED, 1, 2000);
Serial1.flush();
}
asked Jul 9, 2018 in XBee3 ZigBee by Mb-Pejvak New to the Community (0 points)

Please log in or register to answer this question.

...