jnsdbr / esp32-ota-update-mqtt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Precision about preferences

didiergayrard12 opened this issue · comments

Just for my information, how do you provides SSID and Secrets for the dedicated Wifi network ? i have take a look to your code and initially it seems to comes from preferences, but i do not see how you fill your secrets.
Can you explain to me?
Personnally i use an had-hoc wifi manager to enter secrets

Regards

commented

Every time I setup a new device, I run a small code snippet which stores the WiFi credentials into the esps persistant flash memory.

#include "Arduino.h"
#include <Preferences.h>

Preferences preferences;

void setup() {
    preferences.begin("settings", false);
    preferences.putString("WIFI_SSID", "<SSID>");
    preferences.putString("WIFI_SECRET", "<SECRET>");
    preferences.end();
}

void loop() {}

I hope this helps 😅