Serial output with no Serial Monitor

What happens to the Serial output, e.g., Serial.println(F(“String”));, when there is no Serial Monitor present? Does the output consume memory on the UNO or is it just lost?

My concern is that if I include the Serial output functions for debugging purposes then when the program is done and the UNO is running without a connection to the SDK that the Serial output will fill-up memory and stop the program from running.

Perhaps I should surround the Serial output with #define for debugging purposes and then not define the keyword when I am done.

Arduino will send the data just the same, it doesn't know or care that nothing is there to receive it.

arduino39248: Perhaps I should surround the Serial output with #define for debugging purposes and then not define the keyword when I am done.

That would be a good idea.

There is no handshaking, therefore the data is just sent out as if there was a monitor attached. .

Here are some debug macros I use:

#define DEBUG

//***************************************************************
//If you comment the line:    #define DEBUG
//the DPRINT & DPRINTLN lines are defined as blank, thus would be ignored by the compiler
//#define DEBUG  // if this line is NOT commented, these macros will be included in the sketch
//examples:
// DPRINTLN("Testing123");    
// DPRINTLN(0xC0FFEEul,DEC);
// DPRINTLN(12648430ul,HEX);
// DPRINTLNF("This message came from your flash");  

#ifdef DEBUG
#define DPRINT(...)    Serial.print(__VA_ARGS__)
//OR, #define DPRINT(args...)    Serial.print(args)
#define DPRINTLN(...)  Serial.println(__VA_ARGS__)
#define DRINTF(...)    Serial.print(F(__VA_ARGS__))
#define DPRINTLNF(...) Serial.println(F(__VA_ARGS__)) //printing text using the F macro

#else
#define DPRINT(...)     //blank line
#define DPRINTLN(...)   //blank line
#define DPRINTF(...)    //blank line
#define DPRINTLNF(...)  //blank line

#endif
//***************************************************************

What happens to the Serial output, e.g., Serial.println(F("String"));, when there is no Serial Monitor present? Does the output consume memory on the UNO or is it just lost?

It is "lost" as the arduino just twiddles the tx pin between 5v and 0v to send the message. The arduino does not know if anything is attached to the tx pin or not.

You can see it on the TX LED if your board has one.

It's indeed lost and using some sort of debug state is a good idea.

But it will not eat up more memory or something as when it's connected to serial monitor.