As the title says, I want to send MQTT messages to a server using ESP8266 with an Arduino Mega as controller, but so far, every library that I have found is based on Ethernet. I don't want Ethernet, I want WiFi, so those solutions don't work for me.
I have tried using PubSubClient library, but the problem is that to create an instance (PubSubClient client(?????)
), I have to set a client. What should I put in there? Is there another library I must use?
2 Answers
You require an ESP8266 library that implements the Arduino standard Client & Server classes (or at minimum the Client class).
Personally I'd program the ESP8266 directly to make it perform the MQTT request itself (using the libraries bundled with the ESP8266 core). Have the Arduino tell it what to send through some protocol you make yourself over UART.
you have the AT firmware in the esp8266? use WiFiEsp library
or if you can change the esp8266 firmware, you could try JeeLabs esp-link