Home/Support/Support Forum/Communicate bewteen 2 "Arduinos Mega" by using 2 XBee API mode

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

0 votes
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 B []={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, B, sizeof(B));
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("B [");
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,
asked Nov 5, 2015 in XBee Programmable Development by Tanta New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
This is not something that Digi can help with. This is something that you need to ask of one of the support forums dedicated to the Arduino and how to communicate with with an Arduino over XBee.
answered Nov 6, 2015 by mvut Veteran of the Digi Community (14,331 points)
...