Chat freely about anything...

User avatar
By rossoreed
#74253 I'm a little confused about the following 3 lines of code in the MQTT PubSubClient Library example;

Code: Select all// Update these with values suitable for your hardware/network.
byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip(172, 16, 0, 100);
IPAddress server(172, 16, 0, 2);

Do I update the mac[] line with the specific mac address of my Wemos D1 Mini?
...and what are the 'ip' & 'server' addresses? I assume that one of them will be the Mosquitto server IP address (127.0.0.1), but which one? and what is the remaining IPAddress?

A link to the library example - https://github.com/knolleary/pubsubclie ... no#L16-L18
User avatar
By rossoreed
#74297
torntrousers wrote:That example is for an Arduino with Ethernet not for an ESP8266, you don't need them for an ESP8266. There is an ESP8266 specific example - https://github.com/knolleary/pubsubclie ... sp8266.ino

Aah, OK. I had seen that example, but in the sketch's comments it say's;
It will reconnect to the server if the connection is lost using a blocking
reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to
achieve the same result without blocking the main loop.

...so I assumed that the non-blocking example was also suitable for the ESP8266.

No worries, I'll use the ESP8266 blocking version instead.

Thanks torntrousers.