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â¦â:
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â:
The installation process should start immediately upon closing Visual Studio. Once its done, youâll receive the following message:
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:
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:
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 â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:
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:
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:
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.