Q: How to debug an Arduino? A: With the Arduino debugger

Releases available from the Downloads page. If you have any problems please read the Frequently Asked Questions

Aug 2015 - Support for the @Plot command in the Pro version of Visual Micro. Use the breakpoint 'when hit' property to implement any number of graphs. Plot related values on the same graph, set colors, labels, caption. The Arduino program code does not need to be edited to use graphs and the Visual Micro debugging tools.

This page briefly describes some basic features of the Visual Micro Serial Debugger for Arduino ( also works with software serial, xbee, bluetooth etc.). The full documentation can be found here

The Arduino program code does not need to be edited to use the Visual Micro debugging tools!

Update Arduino MCU Variables During A Debug Session

Try it, right click any line(s) of code and insert a breakpoint then press F5 to compile and upload. You can also right click the breakpoint to see more options. You can add multiple breakpoints. Set conditions, timer, watch expressions, call methods for each breakpoint without changing your code!

eye iconDebugging your Arduino Sketch

How to Stop your Sketch, Recompile, and Run

Working with Breakpoints

Controlling breakpoints code halting behavior

The Breakpoint Window

Debugging with Different Ports, Pins and Speeds

How Tracepoints Influence the Execution Speed of Your Sketch

While an Arduino is running, Visual Micro allows you to watch variables/expressions, update expressions, show messages combined with Arduino data, use conditional break points, break/pause/continue the code (step from break point to break point) and use timed or counter based filtering. Two modes: Trace Only or Trace & Break.

Variables can be declared as "modifyable" by including =? after the name. For example;- {myVar=?}. The values of these variables can be changed while the Arduino is running and without re-compile/upload. Variables that can be changed appear in yellow in the expression watch window (see below).

Click and edit the values with yellow backgrounds to change the values on the Arduino (when the breakpoint is next hit/passed). read more

The breakpoint manager (shown at the bottom of the image above) is an easy way to see all of the breakpoints for the current solution.

With the default automatic debugging mode you simply need to change from a Release configuration, add some break points and then press F5 to upload

This debugger does not require any changes to your Arduino source code. Breakpoints can be placed in the direct source code of the sketch (not in library code). Watch on youtube (the youtube tutorial was made prior to automatic enabling of the debugger)

To add a break-point (red spot) to a line fo code, simply left click in the left margin just outside of the editable code. When you left click a red spot will appear which is called a break point.

Right mouse click the break point (red spot) to see a list of options for the break point.

The most useful break point option is the "When Hit" option. Expressions and variables to be monitored can be entered into the "When Hit" break point property. Alternatively add a simple text message that will appear whenever the line of code is reached during Arduino program execution.

For example a "When Hit" property of:-

Hello World milliseconds is currently {millis()}

After adding a "When hit" message and/or watch expressions untick the "Continue Execution" checkbox to switch from a "Trace" point to a break-point. A break-point will pause the code when hit and wait for F5 or a Start command to be issued by the user. A trace point will continue without stopping.

The other break-point options can also be useful such as adding a "Condition" that will cause the break-point to only be hit under specified circumstances. The "hit counter" break-point option is also useful. By default the hit counter specified the number of milliseconds that should elapse between "hits".

Hot Tip 1:

The debugger uses Serial by default. If your sketch code also uses serial then you must ensure that the "Micro Debug>LocalSpeed" and "Micro Debug>RemoteSpeed" project properties are set to the correct value (eg: 9600 baud). The default if you do not set the speed is 115k. Debugging with Different Ports, Pins and Speeds

Hot Tip 2:

Breakpoints are stored in the Visual Studio solution so please remember to save the solution when you exit Visual StudioWe recommend saving the solution with the project or somewhere related to the project.

Hot Tip 3:

Use the "When Hit" breakpoint property to set a textual message and/or declare the {expressions} or {variables} to be watched/modified. Data types can be formatted for display purposes using the standard Arduino print syntax such as {myVar,HEX}. The "When Hit" property caters for "watch with or without text messages", see the following two examples:-

1. Expression and Variable Watch (without text message)


2. Expression and Variable Watch (combined with text message)
Millis is currently {millis()}, myVar is {myVar} and the value of foo is currently {foo} but can be changed during debug.

Hot Tip 4:

The debugger is a software debugger this means that any changes to break point configuration requires the sketch to be re-compiled and uploaded. To entirely clear the debugger from the Arduino you must re-compile and upload in Release mode (or click Debug>Start without debugging)

Hot Tip 5:

Go! To quickly enable debugging change the "Release" configuration in the tool bar to "Debug" (or any another configuration). Add breakpoint(s), then press F5 to upload and start debugging.

Hot Tip 6:

Putting =? after the name of any watch {variable} makes it updateable. This means you can change the value of the variables while the Arduino is running. ie: {foo=?} allows the value of foo to be changed


Breakpoints are stored in the Visual Studio solution so please remember to save the solution when you exit Visual Studio.

We recommend saving the solution with the project or somewhere related to the project.


Additional Debugging Functionality

This is a list of additional functions Visual Micro offers for your Arduino debugging:

  • Breakpoints with counters that stop your sketch only after a number of passes
  • Enabling/Disabling breakpoints: You can activate or deactivate breakpoints with a click of your mouse, without building or uploading your sketch. The Breakpoint Window gives you an overview over all your breakpoints:
  • Trace Only mode
  • Graphical Analog and Digital pin report
  • I2C device scan
  • Real time memory uage
  • User messages (not stored on the arduino)
  • Extensibilty - supports open source plugins
  • Timed (millis) or Counter based breakpoints (example: Trace and expressions watch every 250 ms)

    Breakpoint Window
  • Analog and Digital reporting windows: These windows show you the state of all analog and/or digital pins of your board.

Advanced Users - DEBUG in and ISR?

Keep in mind that Visual Micro defaults to using Serial which might not be possible inside your specific ISR code.

Disable the project property called "Micro Debug>Throttle Enabled" which controls the flow of break-points. Normally the throttle should be ON but for ISR debug it should be off and the break-point hit counters should also NOT be used.