SoftwareSerial with xbee is not working

I’m trying to use my Arduino 1 to send and receive data from others XBEE, I have 2 Arduino Mega with xbee and all works fine, but with the same code and I just replaced the hardwareSerial(Serial1) from the Arduino Mega for SoftwareSerial, but I can’t send and receive nothing, any idea?


SoftwareSerial SerialXbee(2,3);
//Recepcion de datos
XBee DeepXbee = XBee();
XBeeResponse response = XBeeResponse();
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();

//Envio de datos

uint8_t payload[] = {‘E’};
//int Lsb;
//int Msb;
XBeeAddress64 addr64 = XBeeAddress64(0x000000, 0x0000FFFF);
//XBeeAddress64 addr64 = XBeeAddress64(Msb,Lsb);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();


String Mensaje = “N”;

void setup() {



shouldn’t there be ‘#’ for the 1st include statement?

#include or

I finally got a software serial to work last night. I next need to tie-in an XBee3, so I get back with you on this…

oh it is, I forgot select it, sorry.

well, after a lot of tests, I conclude that the problem was the xbee shield, although I previously test it in another arduino and it worked perfectly, for some reason that i don’t know, it doesn’t work with my arduino, that’s so weird, however, I had to connect directly to the arduino and after some tries it worked (I don’t know why It doesn’t work the first time I connected directly, I tried next day as a beginning of search of the problem… and it worked… sometimes I don’t understand…). The problem is solved but the cause is still being a mystery…