Skip to content

๐Ÿ” MQTT library for Arduino that runs WiFi and MQTT in a tight loop, enabling async-like behavior for single-threaded microcontrollers.

License

Notifications You must be signed in to change notification settings

reiniiriarios/arduino-mqtt-looped

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Arduino MQTT Looped Library

Based on the Adafruit MQTT library, this library enables async-like behavior for MQTT and WiFi on single-threaded microcontrollers.

Most Arduino network libraries are filled with delay() and while(true) loops in order to ensure delivery and receipt of packet information. This library instead reads packets and completes tasks over multiple loops.

โš ๏ธ Because packet processing is happening over multiple loops, this library will likely not function well (or at all) with code where additional data is being sent to and from your network outside of this library.

Compatibility

This library is a work-in-progress and is currently only tested with the WiFiNiNA library. Other WiFi libraries will likely work as well, possibly with minor changes. Because the WiFi connection loop cannot be abstracted to a single connect() method, wider compatibility is not easy. If you'd like to adapt this library for a different WiFi driver, look to the wifiSetup(), wifiConnect(), and mqttConnect() and related methods. If you'd like to adapt the library for ethernet, these same methods could likely be simplified or removed from the loop.

Install

The easiest way to install is to search for MQTT_Looped in the Library Manager in the Arduino IDE or VS Code extension.

Usage

See examples for example usage.

About

๐Ÿ” MQTT library for Arduino that runs WiFi and MQTT in a tight loop, enabling async-like behavior for single-threaded microcontrollers.

Topics

Resources

License

Stars

Watchers

Forks

Languages