一、前期准备
1.硬件
淘宝链接
2.软件
1.Arduino:https://www.arduino.cc/en/software
下载后一路下一步安装即可。
2.VSCode下载
官网下载链接:https://code.visualstudio.com/Download
官网下载速度非常慢,如下图所示
解决方法:
右击上图链接,复制下载链接后,将链接中前面的 https://az764295.vo.msecnd.net 替换为 http://vscode.cdn.azure.cn
原下载链接:
https://az764295.vo.msecnd.net/stable/622cb03f7e070a9670c94bae1a45d78d7181fbd4/code_1.53.2-1613044664_amd64.deb
修改后的链接:
http://vscode.cdn.azure.cn/stable/622cb03f7e070a9670c94bae1a45d78d7181fbd4/code_1.53.2-1613044664_amd64.deb
安装vscode,并设置为中文,初次打开Vscode会提示安装语言包
Vscode安装Arduino插件 ,请安装版本0.6之前得版本,0.6之后已经不支持Arduino IDE了
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino
设置Aruino路径
点击设置,输入上一步Arudino的安装路径下的:arduino_debug.exe
设置Arduino 的路径:C:\Program Files (x86)\Arduino
点击
结果如下,不一致的地方是我自己手工添加的
{
{
"workbench.startupEditor": "none",
"arduino.commandPath": "arduino_debug.exe",
"arduino.path": "C:/Program Files (x86)/Arduino",
"arduino.clearOutputOnBuild": true,
"arduino.additionalUrls": [
"https://arduino.me/packages/esp32.json",
"https://arduino.me/packages/esp8266.json"
],
"C_Cpp.default.includePath": [
"C:\\Users\\Administrator\\Documents\\Arduino\\libraries\\**",
"C:\\Program Files (x86)\\Arduino\\libraries\\**",
"C:\\Users\\Administrator\\AppData\\Local\\Arduino15\\packages\\esp32\\**"
],
"explorer.confirmDelete": false,
"arduino.disableTestingOpen": false,
"arduino.skipHeaderProvider": false,
"arduino.disableIntelliSenseAutoGen": true,//是否在项目打开的时候自动检验
}
}
3、设置ESP32 Arduino开发板
打开Arduino IDE菜单 > 文件 >首选项,在 附加开发板管理器网址 输入框中,填入以下网址
如果安装过其他版本的esp32 package,请先删除,再使用本安装包,删除方法:文件管理器地址栏输入 %LOCALAPPDATA%/Arduino15/packages
,回车进入,然后删除掉其中的esp32文件夹
1.离线安装:https://arduino.me/a/esp32
https://arduino.me/packages/esp32.json
离线下载包
https://www.123pan.com/s/dJrKVv-9EGB
链接:https://pan.baidu.com/s/1VF6Kbyb_uwIo_diiFoiy0A
提取码:SSY6
2.在线安装
目前最新版本是:v2.0.2版本
稳定发布链接:
https://www.arduino.cn/package_esp32_index.json (国内)
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json(国外)
开发发布链接:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
搜索ESP32
如果安装失败,一般都是因为网络问题,可以尝试多次重新安装;多次安装失败之后,可能需要翻+0墙;
建议使用离线安装。
解决VS Code报检测到#include错误,请更新includepath的问题
{
"arduino.commandPath": "arduino_debug.exe",
"arduino.path": "C:\\Program Files (x86)\\Arduino",
"workbench.startupEditor": "none",
"C_Cpp.default.includePath": [
"C:\\Users\\Administrator\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\**",
"C:\\Users\\Administrator\\Documents\\Arduino\\libraries\\**",
"C:\\Program Files (x86)\\Arduino\\libraries\\**",
"C:\\Users\\Administrator\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.2\\**"
],
"arduino.clearOutputOnBuild": true
}
安装C++格式化扩展
配置如下
clang-format.exe需要下载使用
链接: https://pan.baidu.com/s/1sB_KpaZKQCleO3UbM5JhuA?pwd=SSY6 提取码: SSY6
"clang-format.executable": "D:\\Downloads\\ProgramFiles\\clang-format\\clang-format.exe",//clang-format.exe所在路径
"clang-format.style": "Google",
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"clang-format.language.cpp.style": "google",
"clang-format.language.cpp.fallbackStyle": "google",
"clang-format.language.c.fallbackStyle": "google"
自用配置
{
"arduino.commandPath": "arduino_debug.exe",
"arduino.path": "E:\\AllINOne\\Arduino\\ArduinoExe",
"workbench.startupEditor": "none",
"arduino.clearOutputOnBuild": true,
"arduino.additionalUrls": [
"https://arduino.me/packages/esp32.json",
"https://arduino.me/packages/esp8266.json"
],
"C_Cpp.default.includePath": [
"E:\\AllINOne\\Arduino\\ArduinoExe\\**",
"C:\\Users\\Administrator\\Documents\\Arduino\\libraries\\**",
"C:\\Program Files (x86)\\Arduino\\libraries\\**",
"C:\\Users\\Administrator\\AppData\\Local\\Arduino15\\packages\\esp32\\**"
],
"explorer.confirmDelete": false,
"arduino.disableTestingOpen": false,
"arduino.skipHeaderProvider": false,
"arduino.disableIntelliSenseAutoGen": true, //是否在项目打开的时候自动检验
"clang-format.executable": "D:\\Downloads\\ProgramFiles\\VSCODE\\VSCodeExtensions\\clang-formatclang-format.exe", //clang-format.exe所在路径
"clang-format.style": "Google",
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"clang-format.language.cpp.style": "google",
"clang-format.language.cpp.fallbackStyle": "google",
"clang-format.language.c.fallbackStyle": "google",
"editor.formatOnSave": true
}