I have two 60mW wire Xbee-PROs running on default settings. I have setup a number of simple tests to check to make sure they are communicating reliably, but no matter what I do, they are dropping characters. I have setup my "send" sketch to send A, B, A, B, A, B, and so on, but what the "receive" sketch is receiving is A, B, B, B, A, A, A, B, B, A randomly, with a few second pause of time in between sporadically. I am using arduino boards on both the receive and send sides.
My "send" program is here. On this side, I have the xbee attached to a Sparkfun xbee shield.
My "receive" program is here. On this side, I have a Sparkfun Explorer attached to an Arduino Mega, which has dedicated serial ports. I have the xbee attached to Serial #2 and an LCD attached to Serial #3 so that I can see what I'm receiving.
Serial3.begin(19200); // setup LCD on Serial 3
Serial3.print(12,BYTE); // clear the LCD
Serial3.println("LCD Ready"); // display LCD Ready on the LCD
Serial2.begin(9600); // setup xbee on Serial 2
Serial2.read(); // read the data from the xbee
if (Serial2.available() > 0)
byte myData = Serial2.read();
Serial3.print(myData); // display the data to the LCD
So, it's a very simple situation, but I can't get the data to come across consistently. I've tried changing the following, but the dropping of characters continues:
- Tried a different shield / explorer.
- Tried different Arduino Mega & Duemilanove boards.
- Tried two firmware versions (written to both xbees so that they were consistent): 10CD and 10E6
- Tried changing the delay times.
- Tried lighting LEDs instead of displaying to the LCD.
The results are always the same. I'm losing characters.
The only thing I haven't tried are these:
- I have not changed any xbee communication settings. (they are at default). My assumption is that I don't need to change any communication settings to get the above test to work. Is that right?
- I have not tried different xbees. Right now I only have the two. I have a third one on order in case one of the two I have is defective.
- Perhaps there is something wrong in my Arduino sketch that I don't understand.
Your help with be much appreciated. My project is dead in the water.