#include <SPIFFS.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// if (!SPIFFS.begin()) {
// Serial.println("An Error has occurred while mounting SPIFFS");
// return;
// }
if (!SPIFFS.begin(true))
{
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
// Initialize serial communication and mount SPIFFS as shown in Step 2
// Open a file for writing
File file = SPIFFS.open("/data.txt", "w");
if (!file) {
Serial.println("Failed to create file");
return;
}
// Write data to the file
file.println("Hello, SPIFFS!");
// Close the file
file.close();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}