XBee: Send data to specific Node in a Mesh

Hi mates.

I’m working on a mesh network made up of 1 Coordinator and several Routers (every XBee S2, API mode), that can join the network at any time. That’s why I’m using the NodeDiscovery function. The coordinator discovers every Router joined, and inside the ND function, every Router sends back a packet that has its Address. So I’m able to store those addresses in a matrix: for example, int devices[50][17] 50 maximum devices.

I know the way to send data from Coordinator to one specific Router:

-XBeeAddress64 addr (0x0013a20040a1f246) //One Router address
-ZBTxRequest zbTx = ZBTxRequest(addr, payload, sizeof(payload));

But instead of doing this last step, is there a way in which I could use the stored address of some XBee Router in the previous matrix?

The next code is a little part of what I’m trying to do.

int devices[100][17];

//Once inside the NodeDiscovery function

while(xbee.readPacket(timeout)) { // should be receiving AT command responses
  if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {
    if (response.isOk()) {
     for (int i = 2; i < 10; i++) {
      devices[nodeCount]=response.getValue(); //Stores the addres of the Nodes found


The code may not be correct at all. I’m a beginner. My apologies.

To sum up, I’m trying to find a way to store the address of every Router found in order to use it later to send data. For example ‘Hi1’ to Router1, ‘Hi2’ to Router 2, etc.

If anyone has some advice I would appreciate it.