Hi there,
In the youtube video on the debug page you will see that you can switch to the "Debug" (or ano) configuration and then enable the (Micro Debug) property. This then allows you to easily switch between "release" non-debug and "Debug" modes very easily. You must then compile and upload to complete the switch between debug and non-debug program versions.
+ When (Micro Debug) is enabled you have the option to "Debug>Start" WITH or WITHOUT debugging.
So this describes two ways to switch between debug mode and non-debug mode.
When you compile without debug then breakpoints are ignored and the serial will be clean.
The debugger works via usb serial by injecting serial debug commands into a temp copy of the current sketch. This must be done during compilation and therefore, as explained above, you must compile and upload when a change to debug mode, breakpoints or expressions is made and this should answer your question as to how to put the arduino back in normal serial mode.
The default for the debugger is to use the standard upload serial port. This does allow you to share the serial port but not if you also have a program that wants to use the port at the same time as the debugger runs.
It sounds like it would be best for your project if the debugger used a different serial port. Using a different port is an option of the debug.
The debugger supports two different transports, HardwareSerial and SoftwareSerial.
If you are using a larger arduino chip such as a 1280 or 2560 then you can use the HardwareSerial ports of the Arduino which are named Serial, Serial1, Serial2, Serial3 etc. Obviously "Serial" is the default and is the main upload port of any Arduino which we don't want to use in this case. So you could buy an FTDI cable and connect to tx1/rx2 or tx2/rx2 on the Arduino and use for dedicated debugging. In this case you would enter "Serial1" or "Serial2" in the "RemotePort" project property and in the "LocalPort" project property enter the COMx port of the FTDI cable that appears when you plug it in to the computer.
The 2nd option that works with all Arduino chips is again to use an FTDI cable but with the "RemoteTransport" project property set to "SoftwareSerial". In this case the FTDI will connect to any two arduino digital pins that support interrupts. Actually, if you are not stopping (break/pause) on breakpoints and not updating variables on the running Arduino the debugger only requires a single Arduino digital pin (tx/transmit).
With the softwareSerial option I recommend setting the RemoteSpeed to 57k or 19k which will ensure that debugger comms between pc and arduino works at a slower speed that the 115k default. SoftwareSerial is more reliable at slightly slower speeds than HarwareSerial.
To be clear, If you use a dedicated serial port for debug then you will have two cables connected between the arduino and the pc. This will allow your c# program to work at the same time as the debugger. In this case I would recommend opening two copies of vs, one with your c# windows project and one with the arduino project. This will allow both the windows app and the arduino program to be debugged at the same time
There are some articles on the vm wiki that might clarify some of what I have said. Let me know if it doesn't make sense.
Thanks