Skip to content

Instantly share code, notes, and snippets.

@rorosaurus
Created September 8, 2020 00:04
Show Gist options
  • Save rorosaurus/4d9453473ddfa2228b4bf7ed557568db to your computer and use it in GitHub Desktop.
Save rorosaurus/4d9453473ddfa2228b4bf7ed557568db to your computer and use it in GitHub Desktop.
test filesystem sketch
#include <LittleFS.h>
#define CONFIG_FILENAME F("/wifi_cred.dat")
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// LittleFS.format();
LittleFS.begin();
loadConfigData();
}
void loop() {
// put your main code here, to run repeatedly:
}
void loadConfigData(void)
{
File file = LittleFS.open(CONFIG_FILENAME, "r");
Serial.println("LoadWiFiCfgFile ");
if (file)
{
int line = file.read();
Serial.print((char)line);
while (line != -1){
line = file.read();
Serial.print((char)line);
}
file.close();
Serial.println("\nLOAD OK");
}
else
{
Serial.println("LOAD failed");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment