Hello every body
I need your help about this !
I have a 3 XBee modules and I want to connect the coordinator to PC and the 2 routers to Arduino so I have tried many codes to get communication and nothing worked even I tried to connect coordinator to arduino and tried to communicate with router on arduino and nothing worked...
I have configured the XBee modules with the latest firmware and DH=0, DL=ffff, AP=2 for coordinator and DH=0, DL=0, AP=2 for routers
the code that I had tried is from the following thread
http://arduino.cc/forum/index.php/topic,90128.0.html
The transmitter code :
Code:
#include <XBee.h>
uint8_t text[] = {'H', 'e', 'l', 'l', 'o'};
XBee xbee = XBee();
XBeeAddress64 remoteAddress = XBeeAddress64(0x0013a200, 0x407a3903);
ZBTxRequest zbTx = ZBTxRequest(remoteAddress, text, sizeof(text));void setup () {
delay(1000);
xbee.begin(9600);
}void loop () {
xbee.send(zbTx);
delay(3000);
}
The receiver code :
Code:
#include <XBee.h>
XBee xbee = XBee();
ZBRxResponse zbRx = ZBRxResponse();void setup () {
delay(1000);
xbee.begin(9600);
Serial.println("starting up yo!");
}void loop () {
// 1. This will read any data that is available:
xbee.readPacket();// 2. Now, to check if a packet was received:
if (xbee.getResponse().isAvailable()) {
if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
xbee.getResponse().getZBRxResponse(zbRx);for (int i = 0; i < zbRx.getDataLength(); i++) {
Serial.print("payload [");
Serial.print(i, DEC);
Serial.print("] is ");
Serial.print(zbRx.getData(i));
}
}
}
}
I need to make a simple communication in API mode but nothing work and tested code could help me I will appreciated and I appreciate any help
Regards