Pages: [1]   Go Down
Author Topic: Strange Serial.read() Bug related to Baud Rate?  (Read 438 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 36
blablablabla
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,

i´m currently using a script interfacing the arduino board over serial port by declaring
Code:
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 smiley-wink) 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.
Logged

Florida, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 146
meow!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: