SunFounder ESP32 Starter Kit
2. Fill in the topics you desire to follow and click Subscribe. In the code, we send temperature information to the
topic SF/TEMP.
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
// if the button pressed, publish the temperature to topic "SF/TEMP"
if (digitalRead(buttonPin)) {
long now = millis();
if (now - lastMsg > 5000) {
lastMsg = now;
char tempString[8];
dtostrf(thermistor(), 1, 2, tempString);
client.publish("SF/TEMP", tempString);
}
}
}
3. Hence, we can monitor this Topic on HiveMQ, allowing us to view the information you have published.
1.48 8.5 CheerLights
CheerLights is a global network of synchronized lights that can be controlled by anyone.
Join the LED color-changing community, which allows LEDs around the world to change colors simultaneously.
You can place your LEDs in a corner of your office to remind yourself that you are not alone.
In this case, we also utilize MQTT, but instead of publishing our own messages, we subscribe to the “cheerlights” topic.
This allows us to receive messages sent by others to the “cheerlights” topic and use that information to change the color
of our LED strip accordingly.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name ITEMS IN THIS KIT LINK
ESP32 Starter Kit 320+
1.48. 8.5 CheerLights 185