#include "FS.h"
#include "SD.h"
#include "SD_MMC.h"
void WriteFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
//unsigned long start_time = millis();
Serial.printf("write [%s]...\n", path);
File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("Failed to open file for writing");
return;
}
if (!file.write(buf, len)) {
Serial.println("Write failed");
return;
}
file.flush();
file.close();
Serial.printf("Write [%s] Complete", path);
}
void ReadFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
Serial.printf("read [%s]...\n", path);
File file = fs.open(path);
if (!file) {
Serial.println("Failed to open file for reading");
return;
}
if (!file.read(buf, len)) {
Serial.println("Read failed");
return;
}
file.close();
Serial.printf("Read [%s] Complete: %s", path, buf);
}
void testIO(fs::FS &fs)
{
char buf[] = "hello world";
WriteFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
ReadFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("请插入内存卡");
delay(8000);
/* SD_MMC 4-bit Mode */
if (!SD_MMC.begin()) {
Serial.println("Card Mount Failed");
return;
}
testIO(SD_MMC);
SD_MMC.end(); // 取消SD挂载
}
void loop() {
}
#include "FS.h"
#include "SD.h"
#include "SD_MMC.h"
void WriteFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
//unsigned long start_time = millis();
Serial.printf("write [%s]...\n", path);
File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("Failed to open file for writing");
return;
}
if (!file.write(buf, len)) {
Serial.println("Write failed");
return;
}
file.flush();
file.close();
Serial.printf("Write [%s] Complete", path);
}
void ReadFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
Serial.printf("read [%s]...\n", path);
File file = fs.open(path);
if (!file) {
Serial.println("Failed to open file for reading");
return;
}
if (!file.read(buf, len)) {
Serial.println("Read failed");
return;
}
file.close();
Serial.printf("Read [%s] Complete: %s", path, buf);
}
void testIO(fs::FS &fs)
{
char buf[] = "hello world";
WriteFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
ReadFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("请插入内存卡");
delay(8000);
/* SD_MMC 1-bit Mode */
if (!SD_MMC.begin("/cdcard", true)) {
Serial.println("Card Mount Failed");
return;
}
testIO(SD_MMC);
SD_MMC.end(); // 取消SD挂载
}
void loop() {
}
#include "FS.h"
#include "SD.h"
#include "SD_MMC.h"
void WriteFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
//unsigned long start_time = millis();
Serial.printf("write [%s]...\n", path);
File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("Failed to open file for writing");
return;
}
if (!file.write(buf, len)) {
Serial.println("Write failed");
return;
}
file.flush();
file.close();
Serial.printf("Write [%s] Complete", path);
}
void ReadFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
Serial.printf("read [%s]...\n", path);
File file = fs.open(path);
if (!file) {
Serial.println("Failed to open file for reading");
return;
}
if (!file.read(buf, len)) {
Serial.println("Read failed");
return;
}
file.close();
Serial.printf("Read [%s] Complete: %s", path, buf);
}
void testIO(fs::FS &fs)
{
char buf[] = "hello world";
WriteFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
ReadFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("请插入内存卡");
delay(8000);
/* SD SPI Mode at HSPI */
SPIClass spi = SPIClass(HSPI);
spi.begin(14 /* SCK */, 12 /* MISO */, 13 /* MOSI */, 15 /* SS */);
if (!SD.begin(15 /* SS */, spi, 80000000)) {
Serial.println("Card Mount Failed");
return;
}
testIO(SD);
SD_MMC.end(); // 取消SD挂载
}
void loop() {
} 采用 32GB 闪迪 TF卡出现以下问题:
#include "FS.h"
#include "SD.h"
#include "SD_MMC.h"
void WriteFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
//unsigned long start_time = millis();
Serial.printf("write [%s]...\n", path);
File file = fs.open(path, FILE_WRITE);
if (!file) {
Serial.println("Failed to open file for writing");
return;
}
if (!file.write(buf, len)) {
Serial.println("Write failed");
return;
}
file.flush();
file.close();
Serial.printf("Write [%s] Complete", path);
}
void ReadFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
Serial.printf("read [%s]...\n", path);
File file = fs.open(path);
if (!file) {
Serial.println("Failed to open file for reading");
return;
}
if (!file.read(buf, len)) {
Serial.println("Read failed");
return;
}
file.close();
Serial.printf("Read [%s] Complete: %s", path, buf);
}
void testIO(fs::FS &fs)
{
char buf[] = "hello world";
WriteFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
ReadFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("请插入内存卡");
delay(8000);
/* SD SPI Mode at VSPI */
SPIClass spi = SPIClass(HSPI);
spi.begin(18 /* SCK */, 19 /* MISO */, 23 /* MOSI */, 5 /* SS */);
if (!SD.begin(5 /* SS */, spi, 80000000)) {
Serial.println("Card Mount Failed");
return;
}
testIO(SD);
SD_MMC.end(); // 取消SD挂载
}
void loop() {
} 采用 32GB 闪迪 TF卡出现 VSPI 同样问题,换成 32GB Kingston TF 卡正常。
中断是指计算机运行过程中,出现某些意外情况需主机干预时,机器能自动停止正在运行的程序并转入处理新情况的程序,处理完毕后又返回原被暂停的程序继续运行。
Arduino-ESP32与ESP-IDF的版本对应表。
Arduino-ESP32提供了多种文件系统解决方案,本文将深入解析SPIFFS、LittleFS和SD卡三种主流存储方案,帮助你做出最佳选择。
ESP32-P4-WIFI6-DEV-KIT是一款微雪(Waveshare)设计的基于 ESP32-P4 的多媒体开发板,并集成 ESP32-C6,支持 Wi-Fi 6 和 BLE 5 无线连接。它提供丰富的人机交互接口,包括 MIPI-CSI (集成图像信号处理器 ISP)、MIPI-DSI、SPI、I2S、I2C、LED PWM、MCPWM、RMT、ADC、UART 和 TWAI 等。
ESP-Hosted 解决方案提供了将 ESP 板用作 Wi-Fi 和 Bluetooth/BLE 连接的通信处理器的方法。
ESP-Hosted 提供了一种将ESP芯片和模组用作通信协处理器的解决方案,该解决方案为主机微处理器或微控制器提供无线连接,使主机能够与其他设备通信。简单来说为网卡方案。
Arduino+ESP32上使用TFT_eSPI库快速点亮这个屏幕,驱动芯片ST7789
本文给出了一个ESP32与SPI 接口TFT显示屏接线的详细说明,供大家参考。
本文讲解如何在Micropython环境下使用ESP32的ESPNow功能进行数据传输。
ESP-Dongle 是一款基于 ESP32-S3 芯片开发的多功能 USB Device 解决方案。它不仅外形小巧,功能齐全,更集成了无线 U 盘、SD 卡读取以及 USB 无线网卡等多项功能。
ESP32 系列芯片可以利用 CSI 数据实现动作检测和存在检测。无论是自动调节灯光、风扇,还是节能控制,CSI 技术为智能家居带来了新的可能性。随着 CSI 技术的发展,未来的智能家居将能够更精确地感知和响应我们的行为,实现更高效、更人性化的控制。