Hello,
I hope that this is the right forum to ask for help.
I am working with two XBee Series 3 and one Pololu 3pi+ Robot and trying to build the connection between the robot connected to a XBee and the computer using the XCTU software connected to a XBee.
The write() function does work, I am able to send data from the robot to the XCTU terminal using the API mode. But the other way, XCTU Terminal to Pololu doesn’t work, I am not able read any data.
I am stuck with this problem for some time and tried to google a possible solution, but it was no help.
Connections (Pololu/XBee, RX is 0 and TX is 1 according to the datasheet):
3V3 - VCC
GND - GND
0 - DOUT
1 - DIN
Code which doesn’t work:
#include <SoftwareSerial.h>
SoftwareSerial sserial(0,1);
void setup() {
sserial.begin(9600);
delay(1000);
Serial.println("Setup Complete\n");
}
void loop() {
if (sserial.available() > 0) {
Serial.println("Data Available!\n");
char a = sserial.read();
Serial.println(a);
}
else {
Serial.println("No Data Available\n");
}
}
When I am trying to print just Serial.read() it also doesn’t work, as the Pololu isn’t receiving anything. It is stuck after the setup(), because the if (sserial.available() > 0) is never true. Without the if condition it also doesn’t work.
For example:
#include <SoftwareSerial.h>
SoftwareSerial sserial(0,1);
void setup() {
sserial.begin(9600);
delay(1000);
Serial.println("Setup Complete\n");
}
void loop() {
char a = sserial.read();
Serial.println(a);
}
This just returns:
⸮
⸮
⸮
And so on. Does anyone have a idea what to do? It is really anoying that the write function works, but the read doesn’t.