Go Down

Topic: Serial message between 2 Arduinos using xbees - receiving garbage (Read 828 times) previous topic - next topic


Jan 26, 2013, 09:03 pm Last Edit: Jan 26, 2013, 09:06 pm by caliph Reason: 1
Ladies and Gents,

I am stuck with this little issue and searching could not help either.

I have a setup of 2 Arduinos connected with xbees.
The sending Arduino is sending this message every 5 seconds:

Code: [Select]
int MeasurementID = 1;
Serial.print("<");               // Start Char
Serial.print(">");           // end char


The receiving Arduino is using this code:
Code: [Select]
void setup() {

void loop() {
 while(mySerial.available() > 0) {
   char inChar = mySerial.read();

On the serial monitor I receive this:
Basically the first char of the message is correct then I receive garbage.

Can anybody tell me why I recieve this?


probably best to post all the code for both. Is MeasurementID possibly a non printable value?
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


You are using software  serial port?

Is it running at 57600? That is too fast for software  serial,if you are doing it.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


Thanks for your hint on checking the baudrate.

In the Softwareserial description I found:
" It is possible to have multiple software serial ports with speeds up to 115200 bps."
So I thought I was ok... but:

Nevertheless I changed by baudrate down to 9600 and it solved my problem. Strange though.


Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

Go Up