Learn how to set up Microsoft’s Visual Studio Code and get more features as you work on your Arduino Projects!
While Arduino IDE is an easy-to-use and functional IDE a lot of us use for our Arduino projects, it may not contain all the features you want in an IDE. Microsoftâs Visual Studio (VS) Code is a free application that works on Windows, Mac OS, and Linux.
With a little bit of set up, VS Code can provide many useful features that are not available in Arduino IDE, such as syntax highlighting and intellisence. It can be configured to work with many other languages via its comprehensive extensions system. VS Code has many advantages over Microsoftâs main IDE, Visual Studio â itâs lightweight, easily adaptable, and is multiplatform which means that it also runs on Raspberry Piâs Raspbian operating system.
In this tutorial, I will demonstrate how to set up VS Code for Arduino development within a Windows 10 environment.
Before you begin, you need to install the Arduino IDE on your PC. VS Code uses the Arduino libraries in the background.
Installing VS Code
Once Arduino IDE is installed, VS Code can be downloaded for free. Once itâs downloaded, double click on the exe file to install. Clicking the exe file should display the following License Agreement:
Select “I accept the agreement” and click Next
You can change where VS Code is installed by clicking on the âBrowseâ button, but for most the default location will do. Click âNextâ
I would recommend keeping the defaults for your start menu. Click âNextâ.
The additional tasks dialog box allows you to associate VS Code with most programming file types like *.cpp,*.py or *.ino. This can be useful for quickly opening VS Code when you double click on a programming file. Make sure that âAdd to Pathâ is selected. Click âNextâ.
The above screenshot is just a summary of where VS Code will be installed. Click âInstallâ to begin.
If the installation is successful, you should now see the dialog box above.
When you run VS Code for the first time you may get a Security Alert pop up:
Select âPrivate networks, such as my home or work networkâ and then click âAllow Accessâ.
When you run VS Code for the first time, it will display this window:
Installing Extensions in VS Code
Out of the box, VS Code doesnât support all languages, but there is a large number of extensions that add functionality to support additional features. To enable extensions, either click on the âExtensionâ icon on the left-hand margin of VS Code or use the shortcut âCtrl-Shift-xâ.
Installing the C++ Tools Extension
We need to install Microsoftâs C++ tools extension using the following steps:
- In the search bar type ms-vscode.cpptools
- Select the C/C++ search result
- Click on âInstallâ in the information window on the right
VS Studio Extensions Marketplace
This tutorial has demonstrated how to install just one extension, but I would recommend browsing through Microsoftâs Extension Marketplace to see the vast amount of additional functionality that is available for VS Code.
Here are some of my recommendations for useful extensions available in the Marketplace:
- Dracula â A popular dark theme that is available for many IDEs.
- vscode-icons â Adds file icons to the explorer window.
- Code Spell Checker â Checks all source code for spelling mistakes and suggests corrections.
- Bracket Pair Colorizer â Makes your source code easier to debug by colorizing matching brackets.