Visual Studio Code>Programming Languages>ArduinoNew to Visual Studio Code? Get it now.
The Arduino IDE is required. Please install it from the download page.
The supported Arduino IDE versions are 1.6.x and later are supported.
The Windows Store's version of the Arduino IDE is not supported because of the sandbox environment that the application runs in.
Open VS Code and press F1 or Ctrl + Shift + P to open command palette, select Install Extension and type vscode-arduino.
Or launch VS Code Quick Open (Ctrl + P), paste the following command, and press enter.
You can also install directly from the Marketplace within Visual Studio Code, searching for Arduino.
You can find code samples and tutorials each time that you connect a supported device. Alternatively you can visit our IoT Developer Blog Space or Get Started Tutorials.
Arduino: Board Manager: Manage packages for boards. You can add 3rd party Arduino board by configuring Additional Board Manager URLs in the board manager.
Arduino: Change Baud Rate: Change the baud rate of the selected serial port.
Arduino: Change Board Type: Change board type or platform.
Arduino: Close Serial Monitor: Stop the serial monitor and release the serial port.
Arduino: Examples: Show list of examples.
Arduino: Initialize: Scaffold a VS Code project with an Arduino sketch.
Arduino: Library Manager: Explore and manage libraries.
Arduino: Open Serial Monitor: Open the serial monitor in the integrated output window.
Arduino: Select Serial Port: Change the current serial port.
Arduino: Send Text to Serial Port: Send a line of text via the current serial port.
Arduino: Upload: Build sketch and upload to Arduino board.
Arduino: Upload Using Programmer: Upload using an external programmer.
arduino.path Path to Arduino, you can use a custom version of Arduino by modifying this setting to include the full path. Example: C:\\Program Files\\Arduino for Windows, /Applications for Mac, /home/<username>/Downloads/arduino-1.8.1 for Linux. (Requires a restart after change). The default value is automatically detected from your Arduino IDE installation path.
arduino.commandPath Path to an executable (or script) relative to arduino.path. The default value is arduino_debug.exe for windows,Contents/MacOS/Arduino for Mac and arduino for Linux, You also can use a custom launch script to run Arduino by modifying this setting. (Requires a restart after change) Example: run-arduino.bat for Windows, Contents/MacOS/run-arduino.sh for Mac and bin/run-arduino.sh for Linux.
arduino.additionalUrls Additional Boards Manager URLs for 3rd party packages. You can have multiple URLs in one string with a comma(,) as separator, or have a string array. The default value is empty.
arduino.logLevel CLI output log level. Could be info or verbose. The default value is "info".
arduino.disableTestingOpen Enable/disable automatic sending of a test message to the serial port for checking the open status. The default value is false (a test message will be sent).
arduino.skipHeaderProvider Enable/disable the extension providing completion items for headers. This functionality is included in newer versions of the C++ extension. The default value is false.
The following Visual Studio Code settings are available for the Arduino extension. These can be set in global user preferences Ctrl + , or workspace settings (.vscode/settings.json). The latter overrides the former.
Note: You only need to set arduino.path in Visual Studio Code settings, other options are not required.
The following settings are as per sketch settings of the Arduino extension. You can find them in .vscode/arduino.json under the workspace.
sketch - The main sketch file name of Arduino.
port - Name of the serial port connected to the device. Can be set by the Arduino: Select Serial Port command.
board - Currently selected Arduino board alias. Can be set by the Arduino: Change Board Type command. Also, you can find the board list there.
output - Arduino build output path. If not set, Arduino will create a new temporary output folder each time, which means it cannot reuse the intermediate result of the previous build leading to long verify/upload time, so it is recommended to set the field. Arduino requires that the output path should not be the workspace itself or in a subfolder of the workspace, otherwise, it may not work correctly. By default, this option is not set.
debugger - The short name of the debugger that will be used when the board itself does not have a debugger and there is more than one debugger available. You can find the list of debuggers here. By default, this option is not set.
prebuild - External command before building the sketch file. You should only set one prebuild command. command1 && command2 does not work. If you need to run multiple commands before the build, then create a script.
Before you start to debug your Arduino code, please read this document to learn about the basic mechanisms of debugging in Visual Studio Code. Also see debugging for C++ in VSCode for further reference.
Plug in your board to your development machine properly. For those boards that do not have an on-board debugging chip, you need to use a STLink or JLink connector.
Go to the Debug View (Ctrl + Shift + D). and set breakpoints in your source files.
Press F5 to select your debugging environment.
When your breakpoint is hit, you can see variables and add expression(s) to watch on the Debug Side Bar.
To learn more about how to debug Arduino code, visit our team blog.
See the Change log for details about the changes in each version.
The extension might work on other Linux distributions, as reported by other users, but without guarantee.
You can find the full list of issues on the Issue Tracker. You can submit a bug or feature suggestion, and participate in community driven discussions.
To test, press F5 in VS Code with the "Launch Tests" debug configuration.
This project has adopted the Microsoft Open Source Code of Conduct. For more information please see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This extension is licensed under the MIT License. Please see the Third Party Notice file for additional copyright notices and terms.
If you would like to help build the best Arduino experience with VS Code, you can reach us directly at gitter chat room.