c4ta:iot-workshop:mqtt
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
c4ta:iot-workshop:mqtt [2024/09/11 20:02] – harley.lara | c4ta:iot-workshop:mqtt [2024/09/13 18:10] (current) – [3. Our first MQTT Publish] harley.lara | ||
---|---|---|---|
Line 89: | Line 89: | ||
<file c++ mqtt-publish.ino> | <file c++ mqtt-publish.ino> | ||
#include < | #include < | ||
- | #include < | + | //#include < |
+ | #include < | ||
#include < | #include < | ||
#include < | #include < | ||
- | const uint16_t HTTP_PORT = 443; // Use 443 for HTTPS and 80 for HTTP | + | const uint16_t HTTP_PORT = 80; // Use 443 for HTTPS and 80 for HTTP |
// Replace with your WiFi credentials | // Replace with your WiFi credentials | ||
- | const char* SSID = "Eutopiq"; // [USER INPUT] | + | const char* SSID = "iotlab-mobile"; // [USER INPUT] |
- | const char* PASSWORD = "Eutopiq321"; // [USER INPUT] | + | const char* PASSWORD = "iotlab18"; // [USER INPUT] |
// Create an instance of WiFiClientSecure | // Create an instance of WiFiClientSecure | ||
- | WiFiClientSecure | + | WiFiClient |
// =================== | // =================== | ||
Line 111: | Line 112: | ||
const uint8_t PERIOD_MINUTES = 1; | const uint8_t PERIOD_MINUTES = 1; | ||
- | const char* MQTT_SERVER = "broker.hivemq.com"; // [USER INPUT] | + | const char* MQTT_SERVER = "192.168.1.1"; // [USER INPUT] |
- | const uint16_t MQTT_PORT = 8883; // TLS TCP PORT for HTTPS connections, | + | const uint16_t MQTT_PORT = 1883; // TLS TCP PORT for HTTPS connections, |
- | const char* MQTT_OUTPUT_TOPIC = " | + | const char* MQTT_OUTPUT_TOPIC = " |
- | const char* MQTT_INPUT_TOPIC = " | + | const char* MQTT_INPUT_TOPIC = " |
PubSubClient mqtt_client(wifi_client); | PubSubClient mqtt_client(wifi_client); | ||
Line 140: | Line 141: | ||
// Set the client to verify the server' | // Set the client to verify the server' | ||
- | wifi_client.setInsecure(); | + | |
// Give the client a chance to perform the handshake | // Give the client a chance to perform the handshake |
c4ta/iot-workshop/mqtt.1726077724.txt.gz · Last modified: 2024/09/11 20:02 by harley.lara