Arduino / ESP32 Task Manager Library — runs cooperative, non-blocking tasks at a chosen frequency, on the loop() or in a dedicated FreeRTOS task.
📖 Full documentation and API reference → mathieu.carbou.me/MycilaTaskManager
[env:myproject]
platform = espressif32
framework = arduino
board = esp32dev
lib_deps =
mathieucarbou/MycilaTaskManager@^5.0.0- Go to Sketch → Include Library → Manage Libraries
- Search for
MycilaTaskManager - Install the library by Mathieu Carbou
#include <MycilaTaskManager.h>
Mycila::TaskManager tasks("loop()");
void setup() {
Serial.begin(115200);
tasks.newTask("hello", [](void* params) {
Serial.println("Hello");
}).setInterval(1000);
}
void loop() {
tasks.loop();
}- ESP32 (any variant) with the Arduino framework
- ArduinoJson 7.x — only when
MYCILA_JSON_SUPPORTis defined
All configuration is compile-time. Set the flags in build_flags:
build_flags =
-D MYCILA_JSON_SUPPORT| Macro | Effect |
|---|---|
MYCILA_JSON_SUPPORT |
Enables toJson() on Task, TaskManager and BinStatistics. Requires ArduinoJson 7.x. |
MYCILA_TASK_MANAGER_NO_PARAMS |
Task functions become std::function<void()>. Removes setData() / data() and the void* params argument. |
MYCILA_TASK_MANAGER_NO_CALLBACKS |
Removes onDone() and the done callback. |
MYCILA_TASK_MANAGER_NO_STATS |
Removes all profiling: enableProfiling(), statistics(), BinStatistics. profiled() returns false. |
⚠️ MYCILA_TASK_MANAGER_NO_PARAMSchanges the task lambda signature// default Mycila::Task t("t", [](void* params) { /* ... */ }); // with MYCILA_TASK_MANAGER_NO_PARAMS Mycila::Task t("t", []() { /* ... */ });
Always defined, for runtime or compile-time checks:
MYCILA_TASK_MANAGER_VERSION // "5.0.0"
MYCILA_TASK_MANAGER_VERSION_MAJOR // 4
MYCILA_TASK_MANAGER_VERSION_MINOR // 2
MYCILA_TASK_MANAGER_VERSION_REVISION // 5Logs use the TASKS tag through ESP_LOGx. Control the verbosity with the Arduino core macro:
build_flags =
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUGThis project is licensed under the MIT License — see the LICENSE file for details.
Author: Mathieu Carbou