Button function unavailable if not online

I have a simple app similar to tinker, but have added some buttons to the circuit so that I can use tinker (on phone) or a button to toggle any of the relays.

This works great, but I cannot use the buttons when the particle is trying to reconnect or when it is offline.

Can you suggest a way to still have the button (main loop) active while it is reconnecting?

Any help much appreciated.

For simple cases, you only need to insert this near the top of your source code file:


System threading mode is described here:

There are some caveats and things get more complicated if you’re using things like TCPServer, but for Tinker-like applications it should work with just that one change.

1 Like

Wow, great short solution.
Much appreciated.