Photon stops running user code when not connected to the Cloud: How to avoid this?

When the Photon looses connectivity, the user code will stop running until the board reestablish its connection to the Cloud.

Is it possible to configure somewhere in the software to let the user code running until Photon may be able to connect to its Cloud again?

For example: Let’s say I am controlling a relay by some variable (ex. ‘active_relay = 1’) that is keeping something on. When I loose connection to the cloud, I don’t want this relay to go off (let’s say active_relay is still active or 1). When the Photon connection to the Cloud is reestablished, the code may look to the variable active_relay to see whether it should make the relay keep its original state or to change it after the event.

1 Like

Have a look at the SYSTEM_MODE() instruction
https://docs.particle.io/reference/firmware/photon/#system-modes

And also SYSTEM_THREAD(ENABLED)
https://docs.particle.io/reference/firmware/photon/#system-thread

Since this question has been asked plenty of times before doing a forum search might have helped too
https://community.particle.io/search?q=run%20without%20connection

3 Likes