How hnainiamohamedamine29/esp32_mqtt_iot works
This small ESP32 firmware connects to Wi-Fi, maintains an MQTT connection, publishes sensor/status, and handles device/led commands by setting the onboard LED. The sampled source shows the main runtime stages and their calls; README documents the broker/client arrangement and reconnection behavior. All firmware responsibilities share src/main.cpp; external network components are shown separately.
Main entry points: main.cpp MQTT Client · config.h Network Config
Components 9
ESP32 Firmware
- ESP32 Runtime
src/main.cpp - Wi-Fi Setup
src/main.cpp - MQTT Client
src/main.cpp - LED Handler
src/main.cpp - Network Config
include/config.h
Network Services
- Wi-Fi Network
- MQTT Broker
- GPIO LED
Other components
- MQTT Dashboard
Connections 11
- ESP32 Runtime → Wi-Fi Setup: starts Wi-Fi
src/main.cpp - ESP32 Runtime → MQTT Client: configures client
src/main.cpp - Wi-Fi Setup → Network Config: reads credentials
src/main.cpp - MQTT Client → Network Config: reads broker settings
src/main.cpp - Wi-Fi Setup → Wi-Fi Network: connects to
src/main.cpp - ESP32 Runtime → MQTT Client: checks connection
src/main.cpp - MQTT Client → MQTT Broker: connects and subscribes
src/main.cpp - MQTT Client → MQTT Broker: publishes status
src/main.cpp - MQTT Dashboard → MQTT Broker: sends commands
README.md - MQTT Broker → LED Handler: delivers LED command
src/main.cpp - LED Handler → GPIO LED: sets GPIO 2
src/main.cpp