One of the things you could do in the webserver was to write a number of choices from buttons on the website into EEPROM. I wanted the choices to survive a reboot.
Among the choices was the SSID; you could enter a new SSID into a text field and write that text into EEPROM as well.
So for testing, I used MY_ACCESS_POINT as the SSID of my ESP8266 access point.
Using my computer, I could connect to the access point, get an IP address and talk to the web server, sending clicks and receiving pages. The EEPROM write worked, and things came back after a reboot, including the SSID.
The key is that I saw MY_ACCESS_POINT in the list of things to connect to when the board was powered and did not see it when power was removed.
(Duh, you say. Fair enough. But read on.)
I later decided to try something else with the ESP8266; I wanted to send an email when a switch was closed. I started with some all new code that included the SSID and password of my home WiFi. It too worked great. Using some Serial.prints, I could see it connect, see the IP address delivered by the home router, see it sending emails.
Only, MY_ACCESS_POINT continued to show up on my phone, computer and tablet in the list of SSIDs to connect to.
Huh?
It got weirder. I could connect to it, could get an IP address, and could get a response to a ping. It's no longer a web server, that didn't work, but it really is an access point.
All this with no code saying "be an access point" and somehow reading the old SSID out of the middle of EEPROM memory.
I'm not done yet, it gets weirder still. The board is a Lolin D1 Mini. Thinking of nothing else to do, I picked a different Lolin board in the Arduino IDE, D1 Mini Pro. Compiled and uploaded the code.
It was STILL an access point, only the SSID was now ESP_A4CF12. But as before, I could still connect and get an address.
Back to Lolin D1 Mini and back to MY_ACCESS_POINT for an SSID.
I went so far as to delete everything in the Arduino output directory to assure myself I was starting from fresh. No change.
So I'm at a loss.
Here's the code. Absolute boilerplate. How is this an access point? And how does it know to read the 40th to 60th byte in EEPROM to learn its old SSID? ANY wild guesses appreciated.
(Man, I wish I was still a drinker, because then I'd have an explanation! Or wouldn't care, more likely.)
Alan
-----------------------------------------------------------------
#include <ESP8266WiFi.h>
const char* ssid = "TELUS";
const char* password = "12345678";
void setup() {
Serial.begin(115200);
Serial.print("Connecting To: ");
WiFi.begin(ssid, password);
Serial.println(ssid);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
Serial.println("WiFi Connected.");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
}