mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Reconnect functie toegevoegd
This commit is contained in:
@@ -61,6 +61,21 @@ void setup() {
|
||||
client.setCallback(callback);
|
||||
}
|
||||
|
||||
void reconnect() {
|
||||
// Herstel verbinding met MQTT-broker
|
||||
while (!client.connected()) {
|
||||
Serial.print("Verbinding maken met MQTT...");
|
||||
if (client.connect("ArduinoClient")) {
|
||||
Serial.println("Verbonden!");
|
||||
} else {
|
||||
Serial.print("Fout, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" Probeer opnieuw over 5 seconden...");
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
float h = dht.readHumidity();
|
||||
float t = dht.readTemperature();
|
||||
|
Reference in New Issue
Block a user