Argon or Boron is Particle.disconnect() needed?

I am not sure from the documentation or forum if I need to include the Particle.disconnect() statement. What should I do?

void setup()	{
    Particle.connect();
	waitFor(Particle.connected, 60000); 
	//	Let’s say we are ALWAYS connected here.
}//	END setup()

void loop()	{// At some point we get disconnected from cloud
	if (Particle.connected() == false) {// NOT connected to Particle cloud
		Particle.disconnect();// is this statement required? or can I comment it out?
		Particle.connect();
		waitFor(Particle.connected, 60000);
	} else {
		doStuff();
	}
}//	END loop()

If you’re already disconnected, there’s no reason to disconnect again.

Also, you could simplify that line with:

if !Particle.connected()

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.