Post topics, source code that relate to the Arduino Platform

User avatar
By danbicks
#41174 Hi @jmv_driver,

Pubsubclient is really good. There are 2 versions as previously stated, the one that I have chosen allows re binding of the MQTT server etc when application is running. This gives me the ability to update a config file on the cloud and allow for new settings to be updated on the fly.

After creating various MQTT programs I would advise you to add a ticker to check that the connection is still up every min or so. If not then force a re connect and re subscribe to channels. I have found that even on really good servers some drops should be anticipated. I normally code a reconnect counter so you can easily see how stable the server / connection is.

Good luck

Dans
User avatar
By ftheirs
#46927 Hi piersfinlayson,
could you upload your code so I can use it as example? I'm really new in ESP8266 world and there is a lot of information. Which IDE do you use and why?

Thanks!!


piersfinlayson wrote:I like tuanpmt's esp_mqtt https://github.com/tuanpmt/esp_mqtt. Seems pretty fully functional, and works well with mosquitto.

Now this isn't natively Arduino capable, but I did make some modifications to it to allow it to run in the Arduino environment, alongside other Arduino tasks using the TaskScheduler library.

If people are interested i can make this code available.

I've moved away from the Arduino framework now to using the SDK directly as it's more powerful and I find it more stable.