Hi Waqasaps,
I’m going through a similar problem trying to get the Arduino to talk with the xBee S3B Digimesh in API mode.
Would you please post the Arduino code that you are using for sending the msg and also the code for receiving the message.
This is the code I use to in the Arduino “Sender” for sending data. In this particular case I’m trying to send a “Hi” but I think I’m getting the wrong API message in the output of the Arduino “7E01010107D33A2040B2FA4AFFFE00486955”
I use another Arduino “Receiver” to check what is coming in the serial output of the Arduino Sender. In the real application this output would be connected to the xBee module.
I think the API message that goes out of the Arduino sender should look like “7E 00 10 10 01 00 7D 33 A2 00 40 B2 FA 4A FF FE 00 00 48 69 55”
Do you see anything wrong in mi code?
I’m using Andrew’s library “andrewrapp/xbee-arduino”
// Arduino Sender//////////////////////////////////////////////////////
#include
#include
// Create an XBee object at the top of your sketch
XBee xbee = XBee();
int xBeeRX = 6; // Connect Arduino pin 8 to Xbee TX pin
int xBeeTX = 7; // Connect Arduino pin 9 to Xbee RX pin
SoftwareSerial xBeeSerial(xBeeRX, xBeeTX);// Define SoftwareSerial xBeeSerial RX/TX pins
// Create an array for holding the data you want to send.
uint8_t payload[] = {‘H’,‘i’}; //{48,69} in HEX
// Specify the address of the remote XBee (this is the SH + SL)
XBeeAddress64 addr64 = XBeeAddress64(0x0013A200, 0x40B2FA4A);//0013A20040B2FA4A
// Create a TX Request
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
void setup() {
xBeeSerial.begin(9600); // Start the serial port
xbee.setSerial(xBeeSerial); // Tell XBee to use SoftwareSerial xBeeSerial
}
void loop() {
xbee.send(zbTx);// Send your request
delay(10000);
}
// Arduino Reciver//////////////////////////////////////////////////////
//This Arduino is connected to the xBeeSerial of Arduino Sender. Just for debugging propose. #include
int xBeeRX = 6; // Connect Arduino pin 8 to Xbee TX pin
int xBeeTX = 7; // Connect Arduino pin 9 to Xbee RX pin
SoftwareSerial xBeeSerial(xBeeRX, xBeeTX);// Define SoftwareSerial xBeeSerial RX/TX pins
void setup() {
// initialize both serial ports:
Serial.begin(9600);
xBeeSerial.begin(9600);
}
void loop() {
// read from port xBeeSerial, send to port Serial:
if (xBeeSerial.available()) {
int inByte = xBeeSerial.read();
Serial.print(inByte, HEX);
}
}