Serial Monitor slow to kick in

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?

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

The problem here is defintely not what you think it is :slight_smile:

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.

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.

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.

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.

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

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

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

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.