Particle Electron seems to stop publishing. Why?

Your code is a bit hard to read because of the bad indentation scheme. I hope that’s a byproduct of a copy and paste operation :wink: . Regarding your publishes, you do have multiple back-to-back publishes in various parts of your code such as the Reset and Fan functions. Also, because your code blocks with numerous lengthy delays, it is possible the cloud functionality isn’t being serviced and so the cloud connection is dropping… which would prevent further publishes until the loop exits and the cloud keepalive is serviced again. Are you seeing anything other than breathing cyan on the status RGB during the loop run? If you must block for so long, then you should periodically call Particle.process() to keep the cloud connection active. This thread may have some pertinent information on the Particle.process(). From that post, you may also want to consider running with:

SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);

2 Likes