Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By WereCatf
#38984 Modem-sleep is enabled by default already when you're running a sketch as STA-mode (not in AP or STA+AP!), but it'll keep waking the WiFi up whenever it needs to. You can manually force the WiFi to sleep for however long you want by basically doing the following:
Code: Select all// Insert whatever code here to turn off all your web-servers and clients and whatnot
delay(1); //For some reason the modem won't go to sleep unless you do a delay(non-zero-number) -- no delay, no sleep and delay(0), no sleep

And then wake the WiFi up:
Code: Select allWiFi.forceSleepEnd();
//Insert code to connect to WiFi, start your servers or clients or whatever