\
\
Your are now connected
\
Disconnect your phone from ESP_IOT and connect to your wifi network
\
ESP_IOT web server disabled<\h4>\
\
\
\
");
server.send(200, "text/html", html_connected);
}//end handle_client
// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
int8_t ret;
// Stop if already connected.
if (mqtt.connected()) {
return;
}//end if
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3;
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect();
delay(5000); // wait 5 seconds
retries--;
if (retries == 0) {
// basically die and wait for WDT to reset me
while (1);
}//end if
}//end while
Serial.println(F("MQTT Connected!"));
}//end MQTT_connect