Thanks, I’ll give that a try. The device ran for about 10 hours before ceasing to send MQTT messages. Dissapointing.
I put the WiFi.ready(); before client.connect(“sparkclient”)’ in setup as suggested. We’ll see how that goes.
void setup() {
Serial1.begin(9600);
WiFi.ready();
client.connect("sparkclient"); // connect to the server
if (client.isConnected()) // test publish/subscribe
{
client.publish("outTopic/message","hello world"); // Send "hello world" to broker
client.subscribe("inTopic/message");
}
else {
Serial.println("Connection failed "); // Indicate connection failure
}
} // END SETUP
I’m still not clear of the purpose of SYSTEM_THREAD(ENABLED) and the “true” settings. What are they doing and why do you think they break the sketch?
As usual, Thanks for your time
The Particle.publish is just for some simple debug purpose you can removed them after all will work correct
The function reconnect(); can looks like this:
By the way which os ver. you are running ? 2.0.1 ?
SYSTEM_THREAD(ENABLED) and the "true" setting allows your client to run in separate thread and honestly I don't have a clue why it's not working in your case