I’m working my way through the Learn ESP32 book and thought I’d try using the MQTT protocol to connect from ESP32 to RPi. Does the PubSubClient library (2.6.0) work with the ESP32? It hasn’t been updated in a while so I’m guessing so?
Hi Russell, have you tried this example with the ESP32? https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino
Make sure you change that line: #include <ESP8266WiFi.h>
To: #include <WiFi.h>
That example should work with the ESP32, I haven’t tried it recently, but it should work just fine.
I’ll also be adding to the course a project that uses MQTT in 2 or 3 weeks.