User Tools

Site Tools


256mqtt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
256mqtt [2024/11/23 16:05] – created jwan256mqtt [2025/10/10 10:15] (current) – external edit 127.0.0.1
Line 59: Line 59:
     connectmqtt();     connectmqtt();
 } }
 +
 +</code>
 +
 +In the loop:
 +<code>
 +  mqtt_client.loop();
 +
 +  if (!mqtt_client.connected()) {
 +    connectmqtt();
 +  }
 </code> </code>
  
Line 90: Line 100:
 bool publish(const char topic[], const char payload[], int length); bool publish(const char topic[], const char payload[], int length);
 bool publish(const char topic[], const char payload[], int length, bool retained, int qos); bool publish(const char topic[], const char payload[], int length, bool retained, int qos);
-</code> 
- 
-To reconnect if disconnected: 
-<code> 
-void loop() { 
-    if (!mqtt_client.connected()) { 
-        connectomqttbroker(); 
-    } 
-    mqtt_client.loop(); 
-} 
 </code> </code>
  
Line 117: Line 117:
 Below link: Below link:
  
-https://docs.emqx.com/en/cloud/latest/connect_to_deployments/esp8266.html+https://registry.platformio.org/libraries/256dpi/MQTT 
 +https://github.com/256dpi/arduino-mqtt
  
  
256mqtt.1732377917.txt.gz · Last modified: (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki