#include <XBee.h>
#include <SoftwareSerial.h>
// Define NewSoftSerial TX/RX pins
#define ssRX 2
#define ssTX 3
SoftwareSerial nss(ssRX, ssTX);
//Create an XBee object
XBee xbee = XBee();
//Define the Destination address of the packets
XBeeAddress64 destaddress = XBeeAddress64(0x0013A200, 0x40C7A5D8);
char Hello[] = "Hello World\n";
void setup()
{
Serial.begin(9600);
nss.begin(9600);
xbee.begin(nss);
//xbee.setSerial(nss); //error!!
Serial.println("Goodnight moon!");
}
void loop()
{
Serial.println("in the loop");
ZBTxRequest zbtx = ZBTxRequest(destaddress, (uint8_t *)Hello, strlen(Hello));
xbee.send(zbtx);
delay(1000);
}
I could communicate the software serial port with the xbee library. The xBee’s are in ap1 mode. serial monitor is meaningless flow of data. I could not find the reason.
can you help me please?