I am trying to send serial data from arduino to xbee (series1) and then send to another xbee (series1) wirelessly in API Mode with escapes. However, can not receive or see the data on X-CTU. Following is the code. I deeply appreciate your help.

#include <SoftwareSerial.h> 
// Arduino pin 9 rx connect to xbee tx, Arduino pin 8 tx connect to xbee rx
uint8_t rx = 9;
uint8_t tx = 8;
SoftwareSerial Serial_xbee(rx,tx);

// variable to store the data received
int sensorValue = 0;

// costant values of the frame
const byte startDelimiter = 0x7E;

  // length
const byte MSB_1 = 0x00;
const byte LSB_2 = 0x10;  

  // Frame-specific data
const byte frameType = 0x10;
const byte frameID = 0x0;

  // 64-bit destination address 
const byte MSB_5  = 0x00;
const byte b_6    = 0x13;
const byte b_7    = 0xA2;
const byte b_8    = 0x00;
const byte b_9    = 0x40;
const byte b_10   = 0xB1;
const byte b_11   = 0xB1;
const byte LSB_12 = 0x6F;

  // 16-bit destination network address
const byte MSB_13 = 0xFF;
const byte LSB_14 = 0xFE;

  // broadcast radius
const byte broadcastRadius = 0x0;

  // options
const byte opt = 0x0;

byte sending (byte value) {
return value;

void setup()
  // starts serial communication
  pinMode(7, INPUT);


void loop()
  // send data through xBee
  long sum = 0; // accumulate the checksum  
  sum += sending(frameType);
  sum += sending(frameID);
  sum += sending(MSB_5);
  sum += sending(b_6);
  sum += sending(b_7);
  sum += sending(b_9);
  sum += sending(b_10);
  sum += sending(b_11);
  sum += sending(LSB_12);
  sum += sending(MSB_13);
  sum += sending(LSB_14);
  sum += sending(broadcastRadius);
  sum += sending(opt);
  sum += sending(0X10);  // this is the payload[0] byte
  sum += sending(0X10);  // this is the payload[1] byte
  sending( 0xFF - (sum & 0xFF));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.