Mmiscool wrote:I use the following 2 functions to read and write data to the spiffs flash.
Maybe it will be helpful to you.Code: Select allvoid SaveDataToFile(String fileNameForSave, String DataToSave)
{
Serial.println(fileNameForSave);
//SPIFFS.begin();
File f = SPIFFS.open(String("/data/" + fileNameForSave + ".dat"), "w");
if (!f)
{
PrintAndWebOut(F("file open failed"));
}
else
{
f.println(String(DataToSave + String('\r')));
f.close();
}
return;
}
String LoadDataFromFile(String fileNameForSave)
{
String WhatIwillReturn;
//SPIFFS.begin();
File f = SPIFFS.open(String("/data/" + fileNameForSave + ".dat"), "r");
if (!f)
{
fileOpenFail = 1;
//Serial.print("file open failed :");
//Serial.println(fileNameForSave);
}
else
{
fileOpenFail = 0;
WhatIwillReturn = f.readStringUntil('\r');
WhatIwillReturn.replace("\n", "");
f.close();
return WhatIwillReturn;
}
}
Thanks For Helping but i have another Problem with this Code, When i add Spiffs.begin(); before WiFi.softAP(ssid, password);
Command then the Module Keeps on Resetting with rst and boot errors in Serial.
Please let me know the problem. or if you can run this code on your own esp, ( It will not Brick it , Assured and tested )
Once Again, Your Help is Very Valuable.!