Using XBee.h for XBee communication in API mode

I have two XBee Zigbee PRO modules in API mode. I am using this library (GitHub - andrewrapp/xbee-arduino: Arduino library for communicating with XBee radios in API mode). Right now, my goal is to make the router send a packet to the coordinator who will display its contents in hex on the serial monitor.

My code for the Tx (router) is:

#include <XBee.h>

XBee xbee = XBee();
uint8_t payload[] = {0,0};
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200,0x4157310D);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));

void setup() {
  Serial.begin(9600);
  xbee.setSerial(Serial);
}

void loop() {

  //TRANSMIT
  payload[0] = 0xff;
  payload[1] = 0x00;

  xbee.send(zbTx);
  delay(1000);
}

And for the Rx (coordinator):

#include <XBee.h>

XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
ZBRxResponse rx = ZBRxResponse();

void setup() {
  Serial.begin(9600);
  xbee.setSerial(Serial);
}

void loop() {

  //RECEIVE
  xbee.readPacket();
  if (xbee.getResponse().isAvailable()) {
    if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
      xbee.getResponse().getZBRxResponse(rx);
      for (int i = 0; i < rx.getDataLength(); i++) { 
         Serial.print(rx.getData(i),HEX); 
         Serial.print(", ");
      }
    }
    Serial.println();
  }
}

The problem is, it doesn’t work. Nothing is displayed on the Rx serial monitor, and some random characters are displaying on the Tx. Why is that happening? And how do I fix it? Thanks in advance :slight_smile: