I'm trying to do a test with two Xbee radios where I would send a text message from one XBee radio via XCTU and have the text displayed on a liquid crystal LCD on the receiving side. The problem that I'm seeing is that when I send any character from XCTU, the character would be displayed on the LCD but other random characters get sent with the original character as well. So for example, if I send an "a", on the LCD, I would get "*a" printed on the LCD.
In order to see if the problem was with the LCD, I changed my code so that my sent message would be displayed on the serial monitor. However, even on the serial port I noticed the same problem so it led me to think that the problem is with the communication of the two XBee.
I attached a screenshot of my code and another screenshot of the message received at the serial monitor.
Which XBees (series 1 or series 2) are you using? How are they configured? How are they connected to the Arduinos?
Here is the code:
// include the library code:
#include <LiquidCrystal.h>
#include <SoftwareSerial.h> ////setting pins 7 and 8 on the arduino to act as TX and RX
#include <XBee.h>
char charReceived;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
SoftwareSerial XBee(7, 8); // RX, TX 7,8
void setup() {
// set up the LCD's number of columns and rows:
// lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
XBee.begin(9600);
}
void loop() {
if (XBee.available()) {
charReceived = XBee.read();
lcd.write(charReceived);
Serial.print(charReceived);
}
}
PaulS:
Were you wearing a Darth Vader costume when you did this? How about supplying some USEFUL information, like PAN ID, MY, and DL for each for the XBees?
Unplug the LCD. Put it in a drawer. Lock the drawer. Mail the key to a friend in another country.
You can ask for the key back when you have the XBee communication issue resolved. Of course, removing the LCD may resolve the issue...
Yes, I thought of this previously as well. I modified the code so that instead of printing the received bytes on to the LCD it would print on the serial monitor, but even on the serial monitor I was still receiving gibberish.
Perhaps the issue might be with a setting between the XBee radios that I have to configure?