Arduino ESP32FS 插件使用教程

Arduino ESP32FS 插件使用教程

【免费下载链接】arduino-esp32fs-plugin Arduino plugin for uploading files to ESP32 file system 【免费下载链接】arduino-esp32fs-plugin 项目地址: https://gitcode.com/gh_mirrors/ar/arduino-esp32fs-plugin

项目目录结构及介绍

arduino-esp32fs-plugin/
├── README.md
├── keywords.txt
├── platform.txt
├── tools
│   └── esp32fs.jar
└── examples
    └── FSBrowser
        ├── FSBrowser.ino
        ├── data
        │   └── index.html
        └── README.md
  • README.md: 项目说明文件,包含项目的基本信息和使用指南。
  • keywords.txt: 关键字文件,用于语法高亮。
  • platform.txt: 平台配置文件,定义了编译和上传的工具链。
  • tools/esp32fs.jar: 核心工具文件,用于上传文件到ESP32的文件系统。
  • examples/FSBrowser: 示例项目,展示如何使用文件系统浏览器。
    • FSBrowser.ino: 主程序文件。
    • data/index.html: 存储在文件系统中的示例文件。
    • README.md: 示例项目的说明文件。

项目的启动文件介绍

项目的启动文件是 examples/FSBrowser/FSBrowser.ino。这个文件是一个示例程序,展示了如何使用ESP32FS插件上传文件到ESP32的文件系统,并通过Web服务器提供这些文件。

#include <WiFi.h>
#include <FS.h>
#include <SPIFFS.h>
#include <ESPAsyncWebServer.h>

const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

AsyncWebServer server(80);

void setup() {
  Serial.begin(115200);
  if (!SPIFFS.begin(true)) {
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }
  Serial.println(WiFi.localIP());

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(SPIFFS, "/index.html", "text/html");
  });

  server.begin();
}

void loop() {}

项目的配置文件介绍

项目的配置文件是 platform.txt。这个文件定义了编译和上传的工具链,以及如何调用 esp32fs.jar 工具上传文件到ESP32的文件系统。

## Compiler commands
compiler.c.cmd=xtensa-esp32-elf-gcc
compiler.c.flags=-c -g -Os {compiler.c.extra_flags} -MMD -mlongcalls -DF_CPU=240000000L -DARDUINO=10813 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_DEV" -DESP32 -DCORE_DEBUG_LEVEL=0

## Upload commands
tools.esptool.upload.pattern="{path}/esptool{prog.py_ext} -p {serial.port} -b {upload.speed} write_flash @{board.flash_components} {build.flash_size} {build.flash_freq} {build.flash_mode} {build.flash_start} {build.path}/{build.project_name}.bin"

## ESP32FS tool
tools.esp32fs.cmd=java
tools.esp32fs.path={runtime.tools.esp32fs.path}
tools.esp32fs.pattern="{tools.esp32fs.cmd}" -jar "{tools.esp32fs.path}/esp32fs.jar" "{build.path}" "{build.flash_size}" "{serial.port}"
  • compiler.c.cmd: 定义了C编译器的命令。
  • compiler.c.flags: 定义了编译器的标志。
  • tools.esptool.upload.pattern: 定义了上传固件的命令。
  • tools.esp32fs.cmd: 定义了调用 esp32fs.jar

【免费下载链接】arduino-esp32fs-plugin Arduino plugin for uploading files to ESP32 file system 【免费下载链接】arduino-esp32fs-plugin 项目地址: https://gitcode.com/gh_mirrors/ar/arduino-esp32fs-plugin

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值