Go Down

Topic: serial buffer overflow in Serial monitor? (Read 1 time) previous topic - next topic


I'm using Arduino 0010 on Windows XP  and I've noticed a problem with the serial monitor grinding to a halt (buttons unresponsive, application hangs) when I use Serial.print(myIntValue) in the main loop function if I don't use a delay();

I'm guessing it's caused by overflowing a buffer somewhere (don't know which end of the connection). Unplugging the arduino then caused all sorts of java error messages to appear.
I know common sense  ::) says not to flood the serial output like this, (I was just trying to debug a problem) but I didn't expect the software on the PC side to lock up.  Is this expected behaviour?

As an aside, I've read on the forums the arduino gets reset when the serial monitor is activated/deactivated.

Should I be using a higher baud rate?  What's the maximum I can attain via USB to the serial monitor in windows?

Code: [Select]

void setup()                    
 Serial.begin(9600);           // set up Serial library at 9600 bps
 Serial.println("Hello world!");  // prints hello with ending line break
void loop(){
 val = digitalRead(inputPin);  // read input value
 if (val == HIGH) {            // check if the input is HIGH
   digitalWrite(ledPin, LOW);  // turn LED OFF
 } else {
   digitalWrite(ledPin, HIGH); // turn LED ON


Yea, the serial monitor doesn't handle floods of data very well.  Processing had / has similar issues and there's not even any serial communication involved.  The Java control used to print the messages can only handle so much data and having serial communication happening at the same time just makes it worse.  This is one of those things that we should fix eventually, but I'm not sure how.

You can use up to 115200 baud.  


Thanks,  I'll be more careful in my debugging from now on!

As an aside, I've read on the forums the arduino gets reset when the serial monitor is activated/deactivated.  Is this true?


Yes, the Arduino gets reset when the serial monitor is opened, at least on the Mac and Linux.  I believe that it doesn't under Windows.


Yes, the Arduino does not reset when the serial monitor is opened under windows.
"The early bird may get the worm, but it's the second mouse that gets the cheese!"

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