Corrdinator - Router - Router Communication

XBee projects like the adapter, xBee tutorials, tweetawatt/wattcher, etc. from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sezerk
 
Posts: 1
Joined: Mon Jun 12, 2017 10:48 am

Corrdinator - Router - Router Communication

Post by sezerk »

Hi everyone,

I am working on Xbee (XB24-Z7UIT-004) nowadays. I got 3 xbee, 3 arduino. I want to send a massege from one arduino to the others.

When I configured the coordinator as "Coordinator AT" and the other as "Router AT", everything is OK.
But when I configured them "Coordinator API" and the other as "Router API", it is not OK. After all, I configured the other arduino as "End Device API". But I failed again.

I can see the comminication between 3 arduinos as below. But I could not send message.
Is there anybody who can help me?


Image
Image
Image
Image

You can see the code below

// TRANSMITTER

Code: Select all

#include <XBee.h>
XBee xbee = XBee();

void setup() 
{
 pinMode(13, OUTPUT);
 Serial.begin(9600);
 Serial.flush();
 xbee.setSerial(Serial);
 xbee.begin(Serial); 
}

void loop() 
{
 // Create an array for holding the data you want to send.
 uint8_t payload[] = { 255, 128 };
 
 // Specify the address of the remote XBee (this is the SH + SL)
 XBeeAddress64 addr64 = XBeeAddress64(0x0013A200, 0x40BAA50C);
 
 // Create a TX Request
 ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
 
 // Send your request
 xbee.send(zbTx);

 digitalWrite(13, HIGH);
 delay(100);
 digitalWrite(13, LOW);
 delay(100);
}
// RECEIVER

Code: Select all

#include <XBee.h>

XBee xbee = XBee();
ZBRxResponse ZBRx16 = ZBRxResponse();
#define MAX_FRAME_DATA_SIZE 110

bool toggle = false;
void setup() 
{
 pinMode(13, OUTPUT);
 Serial.begin(9600);
 Serial.flush();
 xbee.begin(Serial); 
}

void loop() 
{
   xbee.readPacket();   
   if (xbee.getResponse().isAvailable()) 
   {
      toggle = !toggle;
      // got something
      xbee.getResponse().getZBRxResponse(ZBRx16);

      //if (ZBRx16.getData(1) == 255)
        digitalWrite(13, toggle);  
   } 
   
}
What I am doing wrong?

User avatar
Franklin97355
 
Posts: 23903
Joined: Mon Apr 21, 2008 2:33 pm

Re: Corrdinator - Router - Router Communication

Post by Franklin97355 »

This might be a question better asked in the Digi forums.

Locked
Please be positive and constructive with your questions and comments.

Return to “XBee products (discontinued)”