I’m always looking for the most productive way to get my work done. When I’m in software-engineer mode, my familiarity with the features of my development environment play a huge role in that efficiency. My favorite integrated development environment (IDE) varies by programming language, but, increasingly – whether I’m programming in C/C++, Javascript or Python – I try to find any excuse I can to use Visual Studio Code.

VS Code (not to be confused with Visual Studio) is a free, open source code editor supported by Microsoft. It has a long list of features including powerful key-bind-ability, file navigation, extensions to support just about any language and a pleasantly modern UI.

I’ve used VS Code as my IDE for platforms ranging from the nRF52840 and the C-based nRF5 SDK to a Raspberry Pi running Python scripts. However, a big chunk of the software development we do here at SparkFun revolves around Arduino, which usually means utilization of the Arduino IDE. Compared to VS Code, the Arduino IDE’s feature-set is limited – there’s basic syntax highlighting, auto formatting, and line numbering, but not much more. It’s missing modern IDE features like:

Quick code navigation – Whether it’s find-by-reference (instantly navigating to the definition of the function you’re using), search-by-symbol (quick navigation to function or symbol definitions within a file), or a quick link to a compilation error, code navigation is critical to managing large code bases.

Auto-complete – This feature can, of course, help complete long constant names, but it can also provide insight into the parameters that a function may be expecting.

Version control integration – Whether you’re using git or SVN, many modern IDE’s provide source-control integration that can show, line-by-line, the changes you’ve made since your last commit.

Refactoring – Need to overhaul a function’s naming scheme? Or convert a common block of code into a function that can be more widely used throughout your application? Sounds like a refactoring job! A modern IDE can help with that.

Integrated Terminal – Whether you use bash or the Windows CMD, an integrated terminal can save you loads of time. This tool allows you to run “make,” “grep,” or any of your favorite terminal commands without ever swapping windows.

Until recently, beyond exploring Arduino’s “Use External Editor” preference, there wasn’t much to be done to add more functionality to the Arduino development workflow. That all changed with the release of Arduino CLI.

Arduino CLI is a command-line software tool that features board and file management functionality plus compilation and programming tools. Whether you want to download a new Arduino library or upload a compiled Arduino sketch to a RedBoard, the Arduino CLI is there for all of your scripting and command-lining needs. Taking it a step further – combined with an IDE or editor (like VS Code) – Arduino CLI can become an integral part of a powerful, DIY Arduino sketch, library, and core development environment.

To document this pairing, I wrote up a quick tutorial:

New!

Efficient Arduino Programming with Arduino CLI and Visual Studio Code

December 6, 2018

How to eschew the Arduino IDE for a combination of and Arduino command-line tool (Arduino CLI) and a professional code editor (Visual Studio Code).

Favorited

Favorite

7

The tutorial explains how to pair VS Code with Arduino CLI to get the best of both development worlds: a modern IDE and the simplicity of Arduino’s API and board support.

We are a participant in the Amazon Services LLC Associates Program (and other potential affiliate networks), an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.