ESP32 如何安装ESP-ADF环境

  1. ESP_ADF安装成功很大程度取决于网络,多尝试几次,建议github的连接git获取,其他方式下载不完全编译就会报错
  2. 前往Espressif 仓库查看 Espressif github仓库,往下滑动搜索ESP-ADF
    在这里插入图片描述
  3. 进入之后可以看到除了ESP-ADF外还有ESP-IDF ,components目录下的 esp-adf-libs 和 esp-sr
    在这里插入图片描述
    在这里插入图片描述
  4. 使用命令获取esp-adf,过程出错或中断可能导致安装失败,建议使用手机开启USB网络共享给电脑尝试,我自己尝试了N遍,换时间尝试几次。
git clone https://github.com/espressif/esp-adf.git	// 拉取esp-adf

git submodule update --init --recursive	// 同步更新子模块
  1. 拉取完整的esp-adf后切换到esp-adf的目录下执行 install.bat 脚本,完成ESP-IDF的安装后 export.bat 才算完成。这个过程注意自电脑的 python版本 环境变量 还有 ESP-IDF 和 ESP-ADF的环境变量设置是否合理。
    我用到的环境变量
    在这里插入图片描述

  2. 安装完成的界面
    在这里插入图片描述

D:\ESP\ESP-ADF>cd esp-adf

D:\ESP\ESP-ADF\esp-adf>export.bat
ADF_PATH: D:\ESP\ESP-ADF\esp-adf
IDF_PATH: D:\ESP\ESP-ADF\esp-adf\esp-idf
Checking Python compatibility
Setting IDF_PATH: D:\ESP\ESP-ADF\esp-adf\esp-idf

Adding ESP-IDF tools to PATH...
WARNING: The following issue occurred while accessing the ESP-IDF version file in the Python environment: [Errno 2] No such file or directory: 'C:\\Users\\zhy123\\AppData\\Local\\Programs\\Python\\Python312\\idf_version.txt'. (Diagnostic information. It can be ignored.)
    C:\Users\zhy123\.espressif\tools\xtensa-esp-elf-gdb\14.2_20240403\xtensa-esp-elf-gdb\bin
    C:\Users\zhy123\.espressif\tools\riscv32-esp-elf-gdb\14.2_20240403\riscv32-esp-elf-gdb\bin
    C:\Users\zhy123\.espressif\tools\xtensa-esp-elf\esp-13.2.0_20240530\xtensa-esp-elf\bin
    C:\Users\zhy123\.espressif\tools\riscv32-esp-elf\esp-13.2.0_20240530\riscv32-esp-elf\bin
    C:\Users\zhy123\.espressif\tools\esp32ulp-elf\2.38_20240113\esp32ulp-elf\bin
    C:\Users\zhy123\.espressif\tools\cmake\3.24.0\bin
    C:\Users\zhy123\.espressif\tools\openocd-esp32\v0.12.0-esp32-20240318\openocd-esp32\bin
    C:\Users\zhy123\.espressif\tools\ninja\1.11.1\
    C:\Users\zhy123\.espressif\tools\idf-exe\1.0.3\
    C:\Users\zhy123\.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64
    C:\Users\zhy123\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64
    D:\ESP\ESP-ADF\esp-adf\esp-idf\tools

Checking if Python packages are up to date...
Constraint file: C:\Users\zhy123\.espressif\espidf.constraints.v5.3.txt
Requirement files:
 - D:\ESP\ESP-ADF\esp-adf\esp-idf\tools\requirements\requirements.core.txt
Python being checked: C:\Users\zhy123\AppData\Local\Programs\Python\Python312\Scripts\python.exe
Python requirements are satisfied.

Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of riscv32-esp-elf-gdb, xtensa-esp-elf-gdb use command 'python.exe D:\ESP\ESP-ADF\esp-adf\esp-idf\tools\idf_tools.py uninstall'
For free up even more space, remove installation packages of those tools. Use option 'python.exe D:\ESP\ESP-ADF\esp-adf\esp-idf\tools\idf_tools.py uninstall --remove-archives'.


Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

Applying patch D:\ESP\ESP-ADF\esp-adf\idf_patches\esp32p4_hosted_and_sdcard_coexistent.patch
Applying patch D:\ESP\ESP-ADF\esp-adf\idf_patches\idf_v5.3_freertos.patch

The following command can be executed now to view detailed usage:

  idf.py --help

Compilation example (The commands highlighted in yellow below are optional: Configure the chip and project settings separately)

  cd D:\ESP\ESP-ADF\esp-adf\examples\cli
  idf.py set-target esp32
  idf.py menuconfig
  idf.py build

The script encountered an error.

D:\ESP\ESP-ADF\esp-adf>idf.py --version
fatal: not a git repository: ../.git/modules/esp-idf
WARNING: Git version unavailable, reading from source
ESP-IDF v5.3.1

D:\ESP\ESP-ADF\esp-adf>
### ESP32 使用 ADF 框架控制 WS2812 LED 教程 #### 设备准备 为了实现通过ESP32使用ADF框架来控制WS2812LED灯,需准备好如下硬件设备[^1]: - ESP32开发板 - WS2812 RGB LED模块 - 连接线若干 - 面包板(可选) #### 软件环境搭建 确保安装并配置好必要的软件工具链和库文件以便于后续编程工作顺利开展。 ##### 安装 Arduino IDE 和 ESP-IDF 工具链 ArduinoIDE是一个非常流行的开源集成开发环境,支持多种微控制器平台;而ESP-IDFAudioDevelopmentFramework则是乐鑫公司专门为音频处理应用所设计的一套SDK。对于本项目而言,建议先下载最新版本的ArduinoIDE,并按照官方文档指示完成ESP32扩展板的支持设置以及ESP-IDF环境变量设定等工作。 ##### 添加第三方库 除了上述基础组件外,还需要额外引入FastLED这样的外部库用于简化RGB灯光效果编写过程。打开ArduinoIDE后依次点击`Sketch->Include Library -> Manage Libraries...`,在弹出窗口内搜索框输入“FastLED”,找到对应条目之后点击右侧按钮进行安装即可。 #### 编写程序代码 下面给出一段简单的示例代码片段展示如何利用ESP32配合ADF框架驱动单颗或多颗串联起来的Neopixel系列彩灯: ```cpp #include "esp_wifi.h" #include "nvs_flash.h" // Import FastLED library. #include <FastLED.h> #define NUM_LEDS 1 // Number of LEDs connected to the board. #define DATA_PIN GPIO_NUM_4 // Pin number where data line is connected. CRGB leds[NUM_LEDS]; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); // Set Wi-Fi mode as station only // Initialize NVS (Non-Volatile Storage). esp_err_t ret = nvs_flash_init(); if(ret != ESP_OK){ Serial.println("Error initializing NVS."); } // Setup FastLED with defined parameters. FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); } void loop(){ static uint8_t hue = 0; // Fill all pixels with a color based on current hue value. fill_solid(leds, NUM_LEDS, CHSV(hue++, 255, 255)); // Show updated colors immediately without waiting for any delay period. FastLED.show(); } ``` 此段C++源码实现了开机自检、WiFi初始化等功能的同时还能够周期性的改变连接着的数据线上输出信号从而达到让指定管脚上的NeoPixel发光二极管呈现出彩虹渐变的效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值