When starting a core , it connects directly to the internet and in case the core disconnects it will try to reconnect but continue executing code . which is perfect .
The problem is when the core Start up without internet connection the core will not execute any kind of code. so in case you put it deep sleep and then wake up and didnt see internet connection it will never work offline mode .
This code is waiting for the user to press a key on the keyboard. We don’t know when the use will press and the code might be stuck here for more than 5 seconds.
@Gentmat, you don’t need the WiFi.off() in setup() since the includes turns both wifi and cloud off.
@kennethlimcp is partially right ( ) regarding WiFi.on() except that only sets a flag. For it to work, your loop must end to pass control back to the background task.
@Gentmat, when your code gets to the end of loop(), control goes back to the background task which does its thing and gives control back to loop() again (from the top).
lol i lost you. so do i need to use it ? or no need . i dont have user input all i care for is reconnext when wifi on and code startup in case no internet available from reset
mmm problems like what. so i know what i wanna go through
my exemple is simple or my request is. i want the core to execute code in case the connection was off after coming from deep sleep
For completeness - if you come across this topic when you search for how to execute code at startup please read the documentation for the STARTUP macro. STARTUP macro