Follow the installation instructions in the Arduino-CLI Github to install Arduino-CLI.
Refer to the Getting Started guide:
- Connect your Arduino board to your PC.
- Install the core for your board.
Note: If your board is identified as "Unknown," the core is likely
arduino:avr
.
Download and install Visual Studio Code from the official website.
In VS Code:
- Open the Extensions Marketplace.
- Search for and install "Arduino Community Edition".
- Open the folder containing your Arduino code in VS Code.
- Click "Select Serial Port" at the bottom of the VS Code window and choose the serial port for your Arduino board.
- A
.vscode
folder with anarduino.json
file will be created. Editarduino.json
as follows:
{
"sketch": "your_sketch_file.ino",
"port": "/your_arduino_port",
"board": "arduino:avr:uno",
"output": "../build",
"intelliSenseGen": "global"
}
Replace
your_sketch_file.ino
and/your_arduino_port
with the appropriate values for your project.
- Press
Ctrl+Shift+P
in VS Code. - Select "Arduino: Library Manager" from the Command Palette.
- Install the libraries specified in your
requirements.txt
file.
- If you have compile errors related to "std::nothrow", follow this link
You are now ready to use Arduino-CLI with VS Code!