818 B
818 B
Arduino ESP32
This is the arduino code that listens to the server's mqtt topic and input or output hardware devices' responses according to them.
Getting Started
Verify and Upload the code to the ESP32 board using Arduino IDE.
Prerequisites
-
install PubSubClient dependency in Arduino IDE.
-
Fill the required values for the following variables in the code:
// WiFi and MQTT Configuration
const char* ssid = "~mnsh-asus-2.4Ghz"; // Replace with your WiFi SSID
const char* password = "ZXHNF660"; // Replace with your WiFi Password
const char* mqtt_server = "broker.emqx.io"; // Replace with your MQTT broker address
const int mqtt_port = 1883;
const char* mqtt_topic = "esp32/control"; // MQTT Topic to subscribe