Learn how you can use the powerful tools in Visual Studio to program and debug your Arduino projects.

The Arduino IDE is a basic tool that lacks a few important features. In an effort to resolve these lapses, I decided to try the VisualMicro, a plugin for Visual Studio 2017 which allows you to develop Arduino applications in the popular IDE.

Before diving into this plugin, make sure to read my tutorial on getting started with Visual Studio. You’ll need to have Visual Studio downloaded and working on your computer before you can use this plugin.

How to Install the Plugin

Start Visual Studio and use the top menu bar to navigate to “Tools” and then choose “Extensions and Updates…”:

launching visual studio

In the window that opens, select “Online” on the left-hand side and then search for “Arduino IDE for Visual Studio”. After you find the correct extension, click “Download”:

download the plugin for visual studio

The installation process should start immediately upon closing Visual Studio. Once its done, you’ll receive the following message:

plugin installed successfully

Configuring the Installation

While it's not necessary to have the original Arduino IDE installed to use this plugin, I highly recommend you do to make the configuration of the plugin easier.

After finishing the installation, reopen Visual Studio. You should see this window:

specify your Arduino IDE location

It’ll ask you to specify the path to your Arduino IDE installation folder. You can also change the sketchbook location and add additional board managers.

If the window doesn’t automatically appear, choose “Configure IDE Locations” from this list:

configure IDE location

Creating a New Project

This works in the same way as for other Visual Studio projects.

Select “File” then “New” and “Project…” (or use Ctrl + Shift + N). This will bring up the following dialogue:

choose arduino project from your list

Choose “Visual C++” from the “Other Languages” option on the left-hand side of the window and then select “Arduino Project” in the main area.

You can change the name and location. Click “OK” when you’re finished.

Once the new project is loaded, check whether the IDE is correctly set up for your board and serial port used. You can use the newly added menu bar for that:

newly added menu bar in Visual studio

Make sure the Arduino IDE version is set and that the proper board and serial port are correctly selected—in the case of this tutorial, I’m using Arduino Uno on COM4.

The button right next to the serial port selection will open the serial monitor:

serial port selection

It’s equivalent to the one in the original Arduino IDE.

Uploading Code to Your Arduino

Once you are ready to upload your application, hit the green “Start” button in the main toolbar (or use F5). The code will be compiled and if there are no errors, it gets sent to your Arduino automatically.

The debugger will then run and execute the program on your board. If you want to transfer a newer version of your program, you’ll need to stop the debugger. You can use the controls on the right side of the toolbar to do so:

image2.png

If you are just evaluating the plugin, you might get prompted to enter a serial key when you first try to upload your code. Simply close that prompt and try to re-upload it, if necessary.

External Libraries

Installing libraries works exactly the same as it does in the original Arduino IDE. However, they can also be added by using the button next to the run controls in the image above.

Debugging for Arduino Projects

Content goes hereDebugging basically works in the same way as it does in other Visual Studio project types. However, there are a few differences where we can recommend that you take a look at the plugin’s official documentation.

Plugins can Help Improve You Visual Studio Use

This plugin is a powerful extension for Visual Studio 2017. It enables you to do many things that the standard Arduino IDE can’t and gives you access to the great Visual Studio tools. This plugin also integrates the features of the Arduino IDE very well which makes it easy to switch.

Unfortunately, you’ll still need to install the default Arduino IDE and the plugin is not free, but is half-off if you’re a student. So if you want more professional tools, you should give it a try. But if your goal is maximum cost efficiency, you should stick to the free Arduino IDE.

Daniel Hertz
Hi! I am a software engineer and owner of nerdhut.de who loves to experiment with electronics, gadgets and tech in general.