Skip to content

How to develop with Visual Studio

Leon Kiefer edited this page Nov 21, 2019 · 3 revisions

As an IDE Visual Studio with the extension Visual Micro can be used. Visual Micro provides the required functionality for free, but sometimes ask you to buy the full version. The Visual Micro plugin allows to use board.txt files, that overwrites the usb settings when uploading to a board. So when using Visual Studio you do not have to use the CLP Boards you can use the normal boards settings for uploading.

When using Visual Studio most steps from the normal setup with Arduino IDE apply. But the following you have to consider when using Visual Studio as IDE:

  • Installing libraries can be done with the integrated Library-Manager
  • When compiling with Visual Studio use the "Release" configuration
  • For debugging don't use the integrated debugger of Visual Studio, as it will most likely break the USB communication.
  • Don't forget to include the board.txt in the root directory of your sketch.

Debugging

Use Serial Monitor and upload the sketch with the Debug mode enabled. To enable the Debug mode, add the following line to the board.txt:

build.extra_flags={build.usb_flags} -DDEBUG

If the board.txt file already contains build.extra_flags add -DDEBUG to the end of the line and remove the # at the beginning of the line if there is one.

For advanced debugging you can use the DebugSketch. In the board.txt file, the default values for the debugging options can be set. After uploading the sketch open the serial monitor with baud rate 115200 and set the line ending to "Line Feed"/"Newline" (\n).