There's an Arduino in your VS Code...

News

Extraordinary Robot
Robot
The final post for the VS Code Theme week comes from the man, the myth, the legend in his own mind :) Fabien Royer.

Given it's Hardware Friday and VS Code week, how can we mesh these two together?

Maybe a little Arduino development with VS Code? Yeah, that's the ticket!

fabienroyer/VisualStudioCodeArduino




Using Visual Studio Code as an Arduino IDE


The arduino IDE is great to get a project configured and started quickly, but its built-in code editor leaves a lot to be desired. Even though an external editor can be used instead, the experience could still be improved upon. With the release of Visual Studio Code for Linux, Windows and Mac OS, there's an opportunity to make coding for arduino enjoyable while preserving the ability to compile and upload sketches directly from the editor. Keep in mind that you'll still need to use the arduino environment at least once to manage a project's imported libraries, target boards settings, serial port settings, etc.

The following document describes how this can be accomplished in three easy steps.

1. Making the 'arduino' executable available


By default, the arduino environment on Linux is not visible outside of its installation directory and needs to be exposed as a command for Visual Studio Code to invoke it when compiling and uploading arduino sketches.

Skip this step if the arduino environment is already available from anywhere.

The following step creates a symbolic link to the arduino environment so that it can be accessed from anywhere. It is assumed that the arduino environment was installed in the user's /home directory, such as:

...

2. Copy the ino folder to your local Visual Studio Code extension folder


The ino folder in this repository provides Visual Studio Code with the arduino keyword definitions needed for syntax highlighting. It also specifies that .ino files should be handled as C/C++ files.

The repository contains the following files & folders:

...

3. Adding the Visual Studio Code Task Runners supporting arduino


From Visual Studio Code, do the following:

  1. Open the File menu and select Open Folder....
  2. Navigate to the folder containing your arduino projects.
  3. Bring up the command palette with Ctrl+Shift+P.
  4. Type task in the command window.
  5. Select Configure Task Runner. This will create a hidden folder named .vscode at the root of the arduino projects folder selected in step 2.

...

4. Usage

  1. Open a .ino project file.
  2. Bring up the command palette with Ctrl+Shift+P
  3. Type task in the command window.
  4. Select Run Task

...



Note


This procedure has been validated to work with the following configuration:

  • Ubuntu Linux 14.04 LTS
  • arduino 1.6.4
  • Visual Studio Code 0.9.x



[Click through for the repo]

Follow @CH9
Follow @coding4fun
Follow @gduncan411

njs.gif


Continue reading...
 
Back
Top