Library that enables event driven applications on the Arduino platform. This is realized by load monitoring event loops, timers and signals similar to those in the Qt framework.
- In the Arduino IDE, navigate to Sketch > Include Library > Manage Libraries
- Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.
- Then search for MicroQt using the search bar.
- Click on the text area and then select the specific version and install it.
- Navigate to the Releases page.
- Download the latest release.
- Extract the zip file
- In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library
-
Signals make it easy to implement the observer pattern while avoiding the boilerplate code. You can send signals with type-correct event information to connected callback functions and object member functions. This may be used for timeouts, user interfaces like buttons and asynchronous I/O.
-
MicroQt has an event loop that must be executed in the loop() function. Tasks registered in that event loop are called periodically. The built-in timers register themselves, but you can also register your own tasks, such as polling for button state changes. In addition, you can enqueue events whose execution is delayed until the control returns to the event loop. Since they block the event loop, it is important that tasks and events can be processed quickly.
-
The current utilization of CPU and RAM can be displayed at regular user-defined intervals.
The interval can be set by eventLoop.setLogIntervalMs(...) and disabled by setting it to 0.
The current load is printed on the serial port as follows:CPU Load: 11% | RAM Load: 22% (467 of 2048 bytes)
-
Timers are used to call functions periodically or once after a specified interval. Since they run in the event loop and a task or event can block it, the correct timing cannot be guaranteed, but it is appropriate in most cases.
-
Synchronizers can be used to wait for a specific event, like a WiFi connection at startup. They appear to block, but in fact they transfer control to the event loop, so that it can continue to process timers and events.
There are several examples implemented in this library. One of the examples is below. You can find other examples here
#include <MicroQt.h>
using namespace MicroQt;
Timer singleShotTimer (1000);
Timer periodicTimer (2000);
void setup() {
Serial.begin(9600);
singleShotTimer.sglTimeout.connect([](){ Serial.println("single shot"); });
singleShotTimer.setSingleShot(true);
singleShotTimer.start();
periodicTimer.sglTimeout.connect([](){ Serial.println("periodic timeout"); });
periodicTimer.start();
}
void loop() {
eventLoop.exec();
}
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell others about this library
- Be friendly: It's my first public library and I've put in a lot of time and work, so please be patient.
- Use reasonable titles: refrain from using overly long or capitalized titles
- Be detailed: refrain from mentioning code problems without sharing your source code and always give information regarding your board and version of the library
- Refactor the Vector-Class while preserving its interface. The current implementation is very inefficient.