我正在和阿杜伊诺和一个ESP32董事会合作。我需要在我的ESP32中写一些文件。但问题是,SPIFFS不再起作用了。我不知道为什么。它一直工作到前天。
但是现在,当我使用Arduino中的SPIFFS_Test -Examples或以下代码时:
#include "SPIFFS.h"
void setup() {
Serial.begin(115200);
if (!SPIFFS.begin(true)) {
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
File file = SPIFFS.open("/test.txt", FILE_WRITE);
if (!file) {
Serial.println("There was an error opening the file for writing");
return;
}
if (file.print("TEST")) {
Serial.println("File was written");
} else {
Serial.println("File write failed");
}
file.close();
Serial.println(SPIFFS.exists("/test.txt"));
Serial.println(SPIFFS.exists("/nonexisting.txt"));
}
void loop() {}我只得到了“失败的错误”。可能的原因是什么?
发布于 2018-11-08 16:57:44
我检查了目录,发现了一些我之前创建的文件。我删除了它们,它又能工作了!
https://stackoverflow.com/questions/53204083
复制相似问题