Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: ritzdank on Feb 15, 2007, 08:14 pm

Title: Strange Serial.read() Bug related to Baud Rate?
Post by: ritzdank on Feb 15, 2007, 08:14 pm
hi,

i´m currently using a script interfacing the arduino board over serial port by declaring
Code: [Select]
Serial.begin(9600);.
tried several com-interfaces on computer side (command line, zterm, arduino serial monitor, pd)etc.. but i´m getting just wrong syntax. after changing the serial rate to 19200 in those programs (not in arduino-code), all of a sudden, it works, but for this project i would need a (working ;)) baud rate of 9600 as i´m using a bluetooth device which can deal only with that specific baud rate?

is there any preference (in ~/Library/Arduino/preferences.txt) which overwrites the Serial.begin definition with another value? Seems like a strange bug to me.
Title: Re: Strange Serial.read() Bug related to Baud Rate
Post by: CosineKitty on Feb 15, 2007, 11:29 pm
It might be helpful if you posted your entire code.  The one line you posted looks fine, so the bug is probably somewhere else in the code.  I use many different baud rates via Serial.begin(), and I have never had a problem like this.
Title: Re: Strange Serial.read() Bug related to Baud Rate
Post by: mellis on Feb 18, 2007, 03:43 pm
It sounds like your Arduino sketch is running twice as fast as it thinks it is.  Did you edit the build.f_cpu variable in your preferences.txt file (e.g. to work with a standalone ATmega8 without an external clock)?  It should be 16000000L for the Arduino board.  You could try simply renaming your preferences.txt so that the Arduino environment generates a fresh one for you.  If none of that works, you could try Serial.begin(4800) which might give you a baud rate of 9600.