-->
Page 1 of 3

Writing to the memory?

PostPosted: Mon Jul 15, 2019 2:04 am
by josephchrzempiec
Hello i was wondering something. I was looking at some of these example codes i found online for Web configuration to a router wireless SSID and password. As i was looking around and seeing i don't have to manually keep putting my SSID and password into the sketch and it can be stored in the memory of the ESP8266. What happens when i say update that configuration sketch to changes colors of the web page and add buttons etc..... Then upload the updated sketch. would my SSID and password be gone would it clear out, Or would it still remain?


Joseph

Re: Writing to the memory?

PostPosted: Mon Jul 15, 2019 2:48 am
by haryaman
As far as I know from experience it remains, but you never know for sure until you try.

Re: Writing to the memory?

PostPosted: Mon Jul 15, 2019 7:50 am
by rudy
The previously set mode, SSID and password are retained by the ESP. Those settings are kept in a settings area separate from the normal areas that our sketches use.

As a test, load a sketch that sets the ssid and password.

// Connect to WiFi network
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

Then load a different sketch but comment out these.

// Connect to WiFi network
// WiFi.mode(WIFI_STA);
// WiFi.begin(ssid, password);

The routines in rom will look at the last settings and use them to connect to the network. As long as you don't change those, and when loading new sketches you have set the following selected Erase Flash: "Only Sketch" (under the tools tab) The ESP8266 will connect to the previously set network.

Re: Writing to the memory?

PostPosted: Mon Jul 15, 2019 12:11 pm
by josephchrzempiec
Hello Rudy sorry I'm still trying to understand this and maybe a little confused. If i comment out them lines it only stops me from using the Station mode but I'm talking about is the access point AP mode. that is what connects to the home router. If i update that wifi manger page with some new text and upload it. What i mean is that does my home router information i put in is that done or still remains?