XBee Increase Baud Rate

Dear All,

I'm using the following to read 3 analog inputs and transfer the data wirelessly to my laptop. I have the following:

1x Arduino Uno with XBee shield
2x XBee
1x XBee-USB Adapter

I have 1 Xbee connected to an Arduino, and I have 1 Xbee connected to the Adapter that is connected to my laptop.

I'm fairly new to microcontroller programming, so I basically just took a bunch of different code online and combined them all into a sketch. I'm testing the baud rate speed (basically trying to determine the relationship between baud rate and sampling rate).

Right now, I'm sampling an analog signal (nothing is electronically hooked up to the analog inputs), and I'm sending hard-coded integers to the other Xbee. Right now, at a Baud Rate of 9600, I can read the numbers from a HyperTerminal serial monitor. However, when I increase the baud rate in my code, for example from 9600 to 19200, when I read the data from the HyperTerminal serial monitor, I get letters instead of numbers.

I attached my code. The part where I change the Baud Rate is Serial.begin(). If you guys think that my code is really inefficient or makes no sense, please let me know. I also have X-CTU, if that helps.

Thanks for your help!

XBee_DataSending.ino (871 Bytes)

Does the XBee's baud rate setting (BD parameter) match that in the sketch?

Yes. I configure both XBee's to the Baud Rate set in the code using X-CTU.

xbee.setSerial() is unnecessary with an Uno.

What happens if

  Serial.begin(19200);
  xbee.setSerial(Serial);

is replaced with

  xbee.begin(19200);    //also does Serial.begin()

I found the problem. Turns out I was setting the baud rate for the Device Manager to 19200 also. Apparently that's a not a good idea. Thanks for the help!