Will serial.print () stop the system if no serial monitor is connected?

I'm sure this is a simple question; and a simple answer will suffice.

If I send data to the serial monitor as part of my sketch, but then disconnect the Arduino from the PC (and power it from a 5vdc power supply), will the serial data that is NOT sent clog up any kind of buffer, and eventually clog the system and cause 'unexpected' results?

Regards, GM

No. I do this all the time with no problems.

But if you put this at the top of your sketch:

#define DEBUG true  //set to true for debug output, false for no debug output
#define Serial if(DEBUG)Serial

then you can define DEBUG as true or false to turn Serial.print() on or off.

The serial data is, in fact, sent. It just doesn’t do anything but flap the TX pin, unless you connect a serial device to it.

Be careful that you do not have a line in setup() like the following:

while (!Serial) {
  ....
};

That is often used on boards where the processor has a built-in USB port, such as the Leonardo, to force the code to wait until a valid USB connection has been established. You can never get past that line of code if the USB is disconnected from the computer.

Great, thank you all. I'll get on with my project now, knowing some new pitfalls, and equally knowing how to avoid them.

GM