I know there are probably about a million of these tutorials all over the internet; however, this is my setup, so I know what I did should I need to do it again…
Prerequisites
- VS Code needs to be installed on your system.
- The standard Arduino IDE needs to be installed.
Installation of Arduino Extension
Open VS Code and press F1
or Ctrl + Shift + P
to open the command palette, select Install Extension and type vscode-arduino
.. Press the Install
button to install. The plugin is written by Microsoft, so should be easy to find. It will also pull in a C/C++ plugin.
Once it has been installed, you will need to make some changes to the plugin’s settings; the easiest way to get it to pick up on the fact that you are needing it to do Arduino magic is by opening a .ino file,
Select a board and serial port from the bottom bar of the application window, and Visual studio code will generate an arduino.json and a c_cpp_properties.json in the folder .vscode in the root folder, you may need to edit the c_cpp_properties.json slightly; if the below code is in the file, it needs to be deleted
{
"name": "Mac",
"compilerPath": "/usr/bin/clang",
"compilerArgs": [],
"intelliSenseMode": "macos-clang-x64",
"includePath": [
"${workspaceFolder}/**"
],
"forcedInclude": [],
"cStandard": "c17",
"cppStandard": "c++98",
"defines": []
},
I have also installed the Better Comments plugin, and Todo Tree plugin (Thanks to Tamarisk for telling me about these ones)