第4篇:vscode+platformio搭建esp32 arduino开发环境

第1篇:Arduino与ESP32开发板的安装方法

第2篇:ESP32 helloword第一个程序示范点亮板载LED

第3篇:vscode搭建esp32 arduino开发环境

1.配置默认安装路径,安装到D盘。

打开环境变量,点击新建

输入变量名PLATFORMIO_CORE_DIR与路径:D:\PLATFORMIO_CORE

d盘创建PLATFORMIO_CORE目录和目录:D:\PLATFORMIO_project

安装python3.8,参考方法

https://www.cnblogs.com/txwtech/p/17659393.htmlhttps://www.cnblogs.com/txwtech/p/17659393.html

安装vscode ,参考第3篇第1点的方法

第3篇:vscode搭建esp32 arduino开发环境

打开vscode,点击扩展,输入platformio,点击安装

安装完成后,点击蚂蚁头像图标,

自动安装PLATFORMIO_CORE,5-10分钟安装完毕

2. 重启vscode

3.配置安装包源路径

D:\PLATFORMIO_CORE\penv\pip.conf,内容替换如下链接

复制代码
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host = mirrors.aliyun.com

3.添加path环境变量

;D:\PLATFORMIO_CORE\penv\Scripts ,添加到path里面

4.复制括号里面的内容,包括分号(;D:\PLATFORMIO_CORE\penv\Scripts)

5.platformio IDE修改创建工程的默认目录

https://www.cnblogs.com/txwtech/p/17651682.html

输入:

复制代码
pio settings set projects_dir D:\PLATFORMIO_project

并回车

输入pio system info可查询当前的目录:

6.下载esp32框架

点击open,platform

点击frameworks,选择Espressif 32

点击install

等待5-10分钟,安装完毕。退出vsocode,再次打开vscode,可查看已经安装

7.新建项目

创建项目慢,请参考:

创建​​​​​​​platformIO安装方法汇总--新建项目下载慢的解决办法

8.创建成功,进入编辑界面

复制代码到编辑窗口

复制代码
/*
  Blink
  Turns an LED on for one second, then off for one second, repeatedly.
  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products
  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman
  This example code is in the public domain.
  https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

// the setup function runs once when you press reset or power the board
// esp32 dev module
#include "Arduino.h"
#define led 2
void setup()
{
  // initialize digital pin LED_BUILTIN as an output.
  Serial.begin(115200);
  pinMode(led, OUTPUT);
}

// the loop function runs over and over again forever
void loop()
{
  digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(1000);
  Serial.println("led is high"); // wait for a second
  digitalWrite(led, LOW);        // turn the LED off by making the voltage LOW
  delay(1000);
  Serial.println("led is low"); // wait for a second
}

9.点击编译

10.编译成功

11.platformio.ini的配置

PlatformIO中的PlatformIO.ini配置

upload_port 根据实际情况配置,在设备管理器查看

复制代码
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
upload_speed = 921600
upload_port = COM3
monitor_port = COM3

12.点击上传

13.上传成功

板载D2 LED开始闪烁

相关推荐
山峰哥5 小时前
SQL性能提升20倍的秘密:这些优化技巧让DBA都惊叹
开发语言·数据库·sql·编辑器·深度优先·宽度优先
Peter·Pan爱编程7 小时前
第六篇:VS Code + Continue 插件:开源爱好者的低成本高自由度方案
ide·开源·ai编程
Karle_7 小时前
为AI编辑器准备c++编译环境,onnxruntime、cmake、cl,网上坑太多备份记录后续方便使用。
开发语言·c++·编辑器
la_vie_est_belle8 小时前
Pygame Studio——用Python自制的一款可视化游戏编辑器
python·游戏·编辑器·游戏引擎·pygame·pyside6·pygame-ce
Thanks_ks9 小时前
【第 002 讲】Python 标准开发环境搭建:运行环境 | 环境变量 | IDE 部署 | 配置优化
ide·python·pycharm·开发工具·环境配置·环境变量·编程基础
shughui9 小时前
2026年最新版Python安装和PyCharm安装教程(图文详细 附安装包)
开发语言·windows·python·pycharm·编辑器
白云LDC17 小时前
Android Studio新建Vecter asset一直显示Loading icons(转圈圈)的解决办法
android·ide·android studio
An_s18 小时前
编辑器AI工具(vscode+claude)
ide·vscode·编辑器
千百元21 小时前
VScode怎么切中文菜单
vscode
zhangfeng11331 天前
部署到服务器上 宝塔系统 使用宝塔在线编辑器 FTP 批量上传 Git 部署 打包上传 codebudyy 编程程序开发
服务器·git·编辑器