Go Down

Topic: Serial Monitor slow to kick in (Read 437 times) previous topic - next topic

DROBNJAK

I upload some code that is using Serial communication to the Arduino.

Than I turn on the Serial Monitor from the IDE. Than I send a character through Serial Monitor.

Now, the funny thing is, nothing happens. I send a character again, again and again. And, after doing that for a while, Arduino responds. Sometimes Arduino accepts character in the first attempt, sometimes I have to send it more than 10 times. After character was accepted, from then on, it accepts each caracter I send without the fuss.

Why are Arduino/Serial Monitor ignoring the characters sent at a begining?

gardner

I suspect there is an error in the design of your sketch.

mromani

The problem here is defintely _not_ what you think it is :-)

GoForSmoke

Are you waiting for the code to finish uploading? That takes a good while on mine.
Do you have code running on the Arduino that is blocking whatever code you have receiving serial i/o, as in big fat DELAYS? Yes, 100 milliseconds counts as fat if it's in a loop.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

PaulS

Don't forget that opening the Serial Monitor resets the Arduino. You need to wait for the Arduino to reboot before you start hammering it with data. The simplest way to know it is ready is to add a Serial.print() statemet at the end of setup(). Don't bother hitting the Send key until you see the message you print.

DROBNJAK


Don't forget that opening the Serial Monitor resets the Arduino. You need to wait for the Arduino to reboot before you start hammering it with data. The simplest way to know it is ready is to add a Serial.print() statemet at the end of setup(). Don't bother hitting the Send key until you see the message you print.


That is the smart cookie. I'll try that.

Just reasoning loudly. My code must be ok, because it works as expected once it receives its first character. Problem must be in some systematic delay, just as PaulS described.

mromani

I usually put a delay(1000) somewhere in setup() so I have the time to launch the serial monitor and catch the println(BANNER).

GoForSmoke

Opening the SM causes the Arduino to reboot? New one to me! I thought my buffer was catching all the text.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

mromani

Opening the serial monitor is like pressing the reset button on the arduino board.

DROBNJAK

Yep, that's what it is. Starting the Serial Monitor (SM) causes Arduino to reboot. And the delay was caused by that reboot.

I've just put something like: Serial.println("Arduino is ready"); into the setup () { ... }. If I wait for this to be printed back to SM, than I can start sending characters back to Ard. through SM.

Go Up