Home/Support/Support Forum/SoftwareSerial with xbee is not working

SoftwareSerial with xbee is not working

0 votes
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?

include <SoftwareSerial.h>
#include<XBee.h>

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();

//variables

String Mensaje = "N";

void setup() {
Serial.begin(9600);
SerialXbee.begin(9600);
DeepXbee.setSerial(SerialXbee);

}

}
asked Jul 17 in ZNet 2.5 by javier_stickman New to the Community (1 point)

Please log in or register to answer this question.

2 Answers

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

#include<SoftwareSerial.h> or
#include<Softwareserial.h>

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...
answered Jul 22 by Mike Simpson New to the Community (1 point)
oh it is, I forgot select it, sorry.
0 votes
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...
answered Jul 23 by javier_stickman New to the Community (1 point)
...