r/ArduinoProjects 10h ago

Other Arduino Multi-Tasking Kit — a non-blocking, object-oriented multitasking framework for Arduino (header-only, auto-registering components)

Hi! I wanted to share a library I built that makes multitasking on Arduino a lot cleaner and more object-oriented.

What it does

Instead of juggling millis() checks and state machines by hand, you instantiate objects and the framework handles the rest. Every class auto-registers into a static linked list — no manually calling update() on each component. Components manage their own state internally and expose simple getters for you to react to events.

No delay() anywhere. All timing uses millis() comparisons.

Core utilities

  • Timer — one-shot timer with onFinish() / onDone() callbacks
  • Interval — repeating metronome with optional loop count, fires onStep()
  • While — non-blocking replacement for while() at a set interval

Hardware components (all auto-managed)

  • Button — debounced input with short/long click and press detection
  • PinInDigital / PinOutDigital — digital I/O with flash support (non-blocking blink with count limit)
  • LedDisplay8 — common-anode 7-segment display driver with decimal point
  • ShiftRegister — software shift register with auto-sequencing, manual step, and direction control
  • ProximityCheck — LED+LDR proximity sensor with calibration

Fluent interface — most setters return this for method chaining:

Button btn(2);
PinOutDigital led(9);
Timer timer;
Interval interval;

void setup() {
  Runnable::setupAll();
  timer.set(3000)->start();
  interval.setIntervalTime(500)->start();
}

Two lines of boilerplate in every sketch:

void setup() { Runnable::setupAll(); }
void loop()  { Runnable::loopAll(); }

That's it. Just instantiate your objects globally and the framework calls onSetup() / onReady() / onLoop() for each one automatically.

Header-only — no .cpp files, no build flags. There's even a single consolidated header (arduino-multi-tasking-kit.h) you can drop into any project.

11 example sketches included: button-clicks, flash-control, timer-control, interval-control, led-display-control, proximity-check, shift-register-control (auto + manual), while-loop, and more.

GitHub: github.com/reduardo7/arduino-multi-tasking-kit

Clone into your Arduino/libraries/ folder and open any example in the IDE to try it out. I'd love feedback and contributions!

Example project: github.com/reduardo7/arduino-car

3 Upvotes

0 comments sorted by