ReConnecting after power glitch

There was a thunderstorm the other day and power went out for about 2 seconds due to lightning. Everything not on a UPS rebooted.
The house router rebooted and reconnected to the Internet, but the Spark core ended up flashing “no connection”, and I had to re-power it one time to get it to reconnect.
I suspect that It couldn’t find the Wi-Fi since that router was rebooting, and the router took longer than the Spark.

How do I have the core “hard reset” every few minutes if it loses (or never gets) a connection?

For example you could check Spark.connected() and issue a System.reset() if needed.

@Awake, @ScruffR is correct except if you are using system mode AUTOMATIC (default). In that case, the user code will block until the Cloud connection is re-established. In MANUAL or SEMI_AUTOMATIC modes the user code will be able to check the status as @ScruffR indicated and do the System.reset(). :smiley:

2 Likes

@peekay123, I’m glad you look over my posts and - where needed - correct some bits I was failing to mention (or didn’t think of :blush:).

2 Likes