Hey, i’m doing desktop lamp and need to add button to erase all wifi data, but can’t get it to work.
I already tried this code in usermod.cpp (called it in userLoop after millis() > 30000):
#define EEPSIZE 2560
//erase wifi name and pass from EEPROM
EEPROM.begin(EEPSIZE);
for (int i = 0; i < 95; i++)
{
EEPROM.write(i, 0);
}
EEPROM.end();
WiFi.disconnect(true);
ESP.restart();
but after restart it still connects to previous network. Is there anything I can do in usermod.cpp to achieve it?
I forgot to mension that my board is esp01 and it doesn’t have builtin button, if that’s what you meant by ‘button’. Anyway it’s still weird that erasing EEPROM and ESP wifi data don’t do the job.
I thought maybe it’s just reset pin, but after i connected button to it and pressed for 6 seconds it’s the same problem as above. Restart → AP turns on for maybe 1 second-> and esp connects back to old network.