Communicate bewteen 2 "Arduinos Mega" by using 2 XBee API mode

Hello dears,

I am trying to send a frame {7E, 0014, 10, 01, 00000000, 0000FFFE, 00, 00, 54, 78, 44, 61, 74, 61, AD} from Arduino to another Arduino.

This frame is Tx (Transmit request) for Xbee protocol and in ASCII it gives “TxData”.
I can send this frame by uisng XCTU in API mode (AP=2) between coordinator and End Device.

I want now to send the same frame by using Arduino.

In the programming, I wrote the following code for the transmitter (my case coordinator):

#include <XBee.h>
XBee xbee = XBee();
ZBTxStatusResponse tx = ZBTxStatusResponse();
XBeeAddress64 address = XBeeAddress64(0x0013A200,0x40A7ECCA);
byte data ={0x7E, 0x00, 0x14, 0x10, 0x01, 0x00, 0x00, 0x00,0x00, 0xFF, 0xFF, 0xFF,0xFE, 0x00, 0x00, 0x54,0x78, 0x44, 0x61, 0x74, 0x61, 0xAD};
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
xbee.setSerial(Serial3);
delay (100);
}

void loop()
{
ZBTxRequest zbTx = ZBTxRequest(address, data, sizeof(data));
xbee.send(zbTx);
delay(1000);

}

And for the receiver (End Device):

#include <XBee.h>
XBee xbee = XBee();
ZBRxResponse rx = ZBRxResponse();
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
xbee.setSerial(Serial3);
delay (100);
}
void loop()
{
xbee.readPacket();
for (int i = 0; i < sizeof (rx); i++) {
Serial.print(“data [”);
Serial.print(i, DEC);
Serial.print("] is ");
Serial.println(rx.getData(i),HEX);
delay (1000);
}
}
The code or frame which I recieved is different from the original one !!
Please, help me !!! I really appreciate your help
Regards,

The code or frame which I recieved is different from the original one !!

How?

Please, help me !!!!!!!!!!

Or what? You'll start another thread?

1 Like

7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html