Skip to content

Instantly share code, notes, and snippets.

@jaindinkar
Last active April 24, 2022 02:55
Show Gist options
  • Save jaindinkar/034f8e228d7c296181143ed70801fa38 to your computer and use it in GitHub Desktop.
Save jaindinkar/034f8e228d7c296181143ed70801fa38 to your computer and use it in GitHub Desktop.
Installing arduino extension for VS Code

Description

Installing Arduino extension for VS code makes development very easy and organised as VS code has integrated git management and the use of workspaces make it easier to isolate certain extensions/plugins to your arduino projects only. Installing the extension and connecting it to the Arduino IDE especially on Ubuntu is bit cumbersome as arduino IDE is installed as a Snap package which has it's own sandbox envionment and hence a bit difficult to provide PATH variable for it's executable to depending application (which in our case is VScode Arduino extension). An alternate solution is provided below which uses the Arduino-cli which is light-weight and feature rich command line tool from arduino devs. You might not need Arduino IDE after this install.

Steps to follow

  • Create a folder named arduino where you will keep all your arduino projects/cloned repos.

  • In a new VS code window create a new workspace named arduino and save it somewhere accessible Ex: "desktop/VSworkspaces/arduino.workspace"

  • Install Arduino extension by microsoft. And disable it globally and re-enable it for this workspace only.

Now comes the trick part providing path for arduino IDE, here instead of IDE we would download compiled version of arduino-cli. I am using v0.20.0 which is currently available.

  • Download and extract the binaries in apps folder in home/user-name/apps/

  • In VScode arduino extension setting, select workspace settings, provide path to the folder as: /home/user-name/apps/cli-folder provide relative path to the executable as: arduino-cli Select using arduino-cli option in settings too.

  • Now restart the vs code. Install boards from arduino: board manager. Add folder to your workspace, and start working.

All the functions should work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment