使用Visual Studio Code开发Arduino

Visual Studio Code官方说明 https://code.visualstudio.com/docs/editor/codebasics
arduino官方插件地址: https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino&ssr=false#overview

遇到问题可以去这里看看https://github.com/Microsoft/vscode-arduino/issues
配置中的几点补充
  • https://mithatkonar.com/wiki/doku.php/arduino/configuring_visual_studio_code_for_arduino_development
  • https://mithatkonar.com/wiki/doku.php/arduino/code_completion
几款免费的Arduino IDE编程工具替代品 https://zhuanlan.zhihu.com/p/81756978
使用Visual Studio Code开发Arduino https://zhuanlan.zhihu.com/p/30868224
常见问题
  • 官方:https://code.visualstudio.com/docs/cpp/faq-cpp
未定义标识符 "Serial"的解决方法
  • https://github.com/microsoft/vscode-arduino/issues/808
  • https://github.com/microsoft/vscode-arduino/issues/438
  • https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019
  • https://cloud.tencent.com/developer/ask/188975
  • https://cuneyt.aliustaoglu.biz/en/enabling-arduino-intellisense-with-visual-studio-code/
我的几个配置文件 几点说明:
  • arduino IDE1.8.10 安装在默认文件夹下
  • IDE中项目文件夹设置为D:\Arduino
  • arduino插件版本0.2.27
  1. settings.json
{ "arduino.path": "C:/Program Files (x86)/Arduino", "arduino.commandPath": "arduino_debug.exe", "arduino.logLevel": "info", "arduino.enableUSBDetection": true, "arduino.disableTestingOpen": false, "arduino.skipHeaderProvider": false, "arduino.defaultBaudRate": 115200, "arduino.additionalUrls": [ "http://arduino.esp8266.com/stable/package_esp8266com_index.json" ], "workbench.colorTheme": "GitHub Plus", "editor.fontSize": 16, "[cpp]": { "editor.defaultFormatter": "ms-vscode.cpptools" } }

【使用Visual Studio Code开发Arduino】"editor.defaultFormatter": "ms-vscode.cpptools"设定文档格式所用排版方式
"workbench.colorTheme": "GitHub Plus":设定vscode显示主题
2. c_cpp_properties.json V1.0
{ "configurations": [ { "name": "Win32", "includePath": [ "D:\\Arduino\\libraries\\**", "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**", "C:\\Program Files (x86)\\Arduino\\tools\\**", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\include\\", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\include\\avr\\", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\lib\\gcc\\avr\\7.3.0\\include", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\lib\\gcc\\avr\\7.3.0\\include-fixed" ], "forcedInclude": [ "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h" ], "browse": { "limitSymbolsToIncludedHeaders": true, "path": [ "D:\\Arduino\\libraries" ] }, "intelliSenseMode": "msvc-x64", "defines": [ "USBCON" ] } ], "version": 4 }

  1. c_cpp_properties.json V1.1
{ "configurations": [ { "name": "Win32", "includePath": [ "D:\\Arduino\\libraries\\**", "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\include", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\lib\\gcc\\avr\\7.3.0\\include", "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\lib\\gcc\\avr\\7.3.0\\include-fixed", "C:\\Program Files (x86)\\Arduino\\tools\\**" ], "forcedInclude": [ "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h" ], "browse": { "limitSymbolsToIncludedHeaders": true, "path": [ "D:\\Arduino\\libraries" ] }, "intelliSenseMode": "msvc-x64", "defines": [ "USBCON" ] } ], "version": 4 }

  1. arduino.json
{ "board": "arduino:avr:uno", "port": "COM5", "sketch": "yunTai.ino", "output": "_vsBuild" }

    推荐阅读