5. May 2012 17:16
The example below shows a single Arduino Serial Port being used for both debug and static serial messages.
The example goes one step further by making use of the DEBUG symbol allowing the static messages to only be included in the program when debuging is enabled for the project.
In the example above the code in the Serial.begin() in the setup() function is not required because both the debugger and the project are using the same port. However, if the defined(DEBUG) condition is removed from the code then Serial.begin() would be required. Therefore it is safer to add Serial.begin() if your sketch code directly uses the Serial port.
The same would apply if the debug "Remote Port" on the project properties was set to a port other than "Serial". In this case you would certainly need to initialise the Serial port.