Reputation: 1
I have two XBees:
Whenever I try to read from the XBee serial in the Arduino, the readings are mostly zeros (instead of data packets as they should be).
It must be noted that using xctu terminal or any other terminal I can read the correct data with no problems whatsoever.
Here is some sample code I'm using:
void setup() {
Serial1.begin(9600); // Here the XBee is connected
Serial.begin(9600);
}
void loop() {
if (Serial1.available()){
Serial.print(Serial1.read());
}
Upvotes: 0
Views: 435
Reputation: 1
After hours upon hours I have finally been able to fix it. I don't know exactly why, but it seems that connecting tx1 and rx1 in reversed order has solved the problem, and now I can communicate between my XBees.
Upvotes: 0