Post topics, source code that relate to the Arduino Platform

User avatar
By nobugz
#66568 I found the following code fragment from "Daemach" on github which will do the trick.
I 'll post it here as reference for readers with the same question.

The code writes a txt file on flashmemory after the format finished succesfully.

Code: Select allSPIFFS.begin();

  if (!SPIFFS.exists("/formatComplete.txt")) {
    Serial.println("Please wait 30 secs for SPIFFS to be formatted");
    SPIFFS.format();
    Serial.println("Spiffs formatted");
   
    File f = SPIFFS.open("/formatComplete.txt", "w");
    if (!f) {
        Serial.println("file open failed");
    } else {
        f.println("Format Complete");
    }
  } else {
    Serial.println("SPIFFS is formatted. Moving along...");
  }