Need help with this code (run the code if there is no internet or wifi)

If the switch operation is so critical for you that you can’t wait in max (yet configurable) 30s, the best way to do is to use ISR (directly or via Hardware Timer Interrupt).

There are so many discussions in the forum about this issue, you can just do some searching and will find them.

For example:

But using ISR correctly is not a simple task, you have to spend some time to study and use it correctly or the percentage of crashing is 100%.

1 Like