Does Serial.begin use resources if serial functions aren't called?

I tend to have more Arduino coding projects in various stages of work than I do physical Arduino boards. Between that and extended periods of time between free time to play with projects, I often forget what code is on a particular Arduino board. I'd like to start adding a simple chunk of code to the setup() loop, with just Serial.begin() and then a quick Serial.print with a reminder of what code (project name, code version, etc) is on the board. That way, I can simply make sure a serial monitor is running, power up the board, and remind myself what I was up to with this particular board. If I don't call any further Serial functions in the code, will Serial continue to consume any resources (other than the memory space for the Serial.print of course)?

Compile the code with then without Serial.begin()

What is reported as memory used ?

On ATmega Arduinos, pins 0 and 1 will be allocated to the UART until you call Serial.end(). Similarly for other Arduinos.

The Serial buffers will continue to be allocated. One for receive and one for send. Actually, I don't think even a Serial.end() will deallocate them. Once they are reserved, they hang around like a relative during the holidays.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.