Unused Serial Monitor Output

While developing an application, I use a lot of Serial.print() and Serial.println() functions for debugging.
In production, I don't need or use the Serial Monitor.

Is there an overhead cost to leaving them in?
Should I comment then out in production code?

Thanks, Tom

(deleted)

tombro728:
Is there an overhead cost to leaving them in?
Should I comment then out in production code?

If the program runs fast enough with the print statements I would not bother to remove them.

You may need to do future development work on it.

...R

I decided on wrapping them in #ifdef’s, as spycatcher2k suggested, simply because Robin2 makes sense in reminding me about future development.

Thanks to both of you! :slight_smile:

tombro728:
I decided on wrapping them in #ifdef's, as spycatcher2k suggested, simply because Robin2 makes sense in reminding me about future development.

Thanks to both of you! :slight_smile:

That is the labor-intensive way of doing it. Instead, define these:

#define Tom_Debug 

#ifdef Tom_Debug 
DBG_PRINT(x) Serial.print(x);
DBG_PRINTLN(x) Serial.println(x);
#else
DBG_PRINT(x) ;
DBG_PRINTLN(x) ;
#endif

Then change the Debug prints in your code to use DBG_PRINT or DBG_PRINTLN instead of Serial.print and Serial.println. Now you can turn all the Debug prints on and off by just commenting out the single line:

#define Tom_Debug

Regards,
Ray L.