Go Down

Topic: Serial message between 2 Arduinos using xbees - receiving garbage (Read 561 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 Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.


You are using software  serial port?

Is it running at 57600? That is too fast for software  serial,if you are doing it.


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.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131