abdulmajeed90 / xbee-arduino

Automatically exported from code.google.com/p/xbee-arduino
Other
0 stars 0 forks source link

No communication between xbees using Arduino #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I configured the coordinator in this way: I opened XCTU and I updated the 
firmware to Coordinator API, after I changed the PAN ID to 0; I could not 
change neither Channel nor the MY parameter.
2. I configured the end device in this way: I opened XCTU and I updated the 
firmware to End Device API, after I changed the PAN ID to 0; In this case too I 
could not change neither Channel nor the MY parameter.
3. I did two sketches one for coordinator and one for end device.

What is the expected output? What do you see instead?
I expected a communication between the xbees, but it wasn't so. From the end 
device I always receive the message "Got an error", it seems it don't receive 
any data from coordinator.

What version of the product are you using? On what operating system?
I'm using two xb24-zb (series 2). I'm using Debian Wheezy.

Please provide any additional information below.
sketch for the coordinator:
#include <XBee.h>

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

void setup(){
  Serial1.begin(9600);
  xbee.begin(Serial1);
}

void loop(){
  Serial.write(Serial.read());
  payload[0] = 'H';
  xbee.send(zbTx);
  delay(2000);
  payload[0] = 'L';
  xbee.send(zbTx);
  delay(2000);
}

sketch for end device:

#include <XBee.h>

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

void setup(){
  pinMode(11, OUTPUT);
  Serial.begin(9600);
  xbee.begin(Serial);
}

void loop(){
  xbee.readPacket();
  if (xbee.getResponse().isAvailable()) {
    if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
      xbee.getResponse().getZBRxResponse(rx);
      if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) {
          //TODO
      } else {
          //TODO
      }
      Serial.write(rx.getData(0));
    } else if (xbee.getResponse().getApiId() == MODEM_STATUS_RESPONSE) {
      xbee.getResponse().getModemStatusResponse(msr);
      if (msr.getStatus() == ASSOCIATED) {
        //TODO
      } else if (msr.getStatus() == DISASSOCIATED) {
        //TODO
      } else {
        //TODO
      }
    } else {
      //TODO
    }
  } else {
    Serial.write("Got an error");
  }
}

Original issue reported on code.google.com by matteo.d...@gmail.com on 21 Feb 2014 at 9:52

GoogleCodeExporter commented 8 years ago
Hi,
The only difference is -
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x40b5ad6e);
and
void setup(){
  Serial.begin(9600);
  xbee.begin(Serial);
}
I am also facing same issue .

Original comment by anupcus...@gmail.com on 22 Feb 2015 at 8:56

Attachments: