I'm working with Arduino and an ESP32 board. I need to write some files in my ESP32. but the problem is, SPIFFS doesn't work anymore. I don't know why... It worked till the day before yesterday.
But now when I use SPIFFS_Test from Arduino-Examples or this code:
#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() {}
I just get the "FAILED ERROR." What could be the reason?
I checked the directory and found some files that I created before. I deleted them and it works again!