Sharing ports between your sketch and the debugger

In many projects, you not only want to use the serial port for debugging, but also for communication between your sketch and the PC.

This document show, how you can share the same port between your sketch and the debugger.

Note IconNote:

If you have a board with two serial ports, and you have spare USB ports on your PC; then it might be easier to use the two port approach, as described here.

If you are only sending messages from the board to your PC

In this case, your sketch and the Visual Micro debugger can easily share the same port.

If you are using or Serial.avaliable() in your code

In this case, your code and the debugger would interfere with each other, because your code would read bytes sent to the board that are intended for Visual Micro's debugger part on the board.

If you switch the debugger to "Trace Only" mode.
In this mode, Visual Micro never sends data to the board, but at the expense of functionality.

Read here about how to switch to "Trace Only" mode"

See also:

Working with the Serial Monitor shows you how serial communications between the board(s) and your PC can be visualized and configured.


Other Pages