This repository shows an implementation to connect an ESP32 to the Datacake MQTT Broker using a secured MQTTS connection.
The button publishes to a mqtt topic which the led is listening to.
- Connect a pushbutton to ESP32 Pin 34 with a pull-down resitor
- Connect a RGB LED to pins R=33, G=32, B=35
Create a new device and add one Field with identifier BUTTONVALUE
and type Boolean
.
The project was made with PlatfromIO, but you can still use it with the Arduino IDE. If you want to use the Arduino IDE make sure you have the PubSubClient library installed.
- make a copy of
src/secrets_template.h
tosecrets.h
- Fill in your WiFi credentials
- Get your Access Token and place it into
MQTT_USER
andMQTT_PASS
- Get your MQTT Topics as described in the Datacake docs and place them into
MQTT_SUB_TOPIC
andMQTT_PUB_TOPIC
- make sure you append
/BUTTONVALUE
to the end of these topics
- make sure you append