How to move Arduino IDE dev work to VSCode?

 To move your Arduino development work from the Arduino IDE to Visual Studio Code (VS Code), you can use the Arduino extension for VS Code developed by Microsoft. This allows you to write, compile, and upload Arduino code directly in VS Code, with more powerful editing and debugging tools.




 Step-by-Step: Move Arduino Projects to VS Code

Install VS Code

Download and install VS Code from:
https://code.visualstudio.com/


Install the Arduino Extension

  • Open VS Code

  • Go to Extensions (Ctrl+Shift+X)

  • Search for “Arduino” (by Microsoft)

  • Click Install

 This extension provides:

  • Syntax highlighting

  • IntelliSense

  • Uploading/flashing support

  • Serial monitor


Install Arduino IDE (if not already installed)

VS Code uses the Arduino CLI under the hood, so make sure the Arduino IDE is installed and accessible in your system path.

Or install the Arduino CLI directly from:
https://arduino.github.io/arduino-cli/


Configure Arduino Extension

  • Press Ctrl+Shift+P and type: Arduino: Board Manager

  • Select your board (e.g., Arduino Uno, Nano, ESP32)

  • Press Ctrl+Shift+P again → Arduino: Select Serial Port

If needed, set the path to your Arduino installation:

json

// settings.json "arduino.path": "C:\\Program Files (x86)\\Arduino"

Open or Create Arduino Project

  • Create or open a folder with your .ino file

  • Save the .ino file inside the folder with the same name as the .ino file

Example:


MyProject/ └── MyProject.ino

🛠 If you open the folder, VS Code should automatically recognize it as an Arduino project.


Use Arduino Commands in VS Code

Use Ctrl+Shift+P (Command Palette) and type:

  • Arduino: Verify – to compile

  • Arduino: Upload – to upload to board

  • Arduino: Open Serial Monitor – to see output

Or use the Arduino toolbar buttons at the top.


(Optional) Use PlatformIO for Advanced Projects

For advanced features (debugging, library mgmt, multi-platform), consider using PlatformIO:

  • Install PlatformIO extension in VS Code

  • Create a new PlatformIO project

  • Import your Arduino .ino code into src/main.cpp and set up your environment


 Summary

StepAction
1Install VS Code
2Install Arduino extension
3Configure board and serial port
4Open or create project folder
5Use command palette to verify/upload
6(Optional) Use PlatformIO for more power

评论

此博客中的热门博文

How To Connect Stm32 To PC?

What is a Look-Up Table (LUT) in an FPGA, and how does it work?

Detailed Explanation of STM32 HAL Library Clock System