Scheduler library

Hey all,

In a recent project I had use for a scheduler library which I ended up writing for myself.

It’s been working very nicely and I thought it might be nice to share with the community.

The code can be found in Particle_Scheduler. The way I use it is by copying over the header and cpp file into my project (wasn’t sure how else to do it).

Example usage as I use it in my project:

#include "scheduling.h";

// Duration
typedef unsigned int Duration;
const Duration Millisecond = 1;
const Duration Second = 1000 * Millisecond;
const Duration Minute = 60 * Second;
const Duration Hour = 60 * Minute;

// Setup scheduler
Scheduler sch = Scheduler();

void setup() {
  sch.add(1200 * Millisecond, &fOne); // run every 1.2 seconds
  sch.add(30 * Minute, &fTwo); // run every 30 minutes
  sch.add(1 * Hour, &fThree); // and so on..
  sch.add(24 * Hour, &fFour);

void loop() {;

// some random functions

void fOne() {

void fTwo() {

void fThree() {

void fFour() {

It’s fairly simple but I’d be happy if this ended up useful to someone else.



nice job.

Are you familiar wth Software Timers (which don’t need to rely on polling millis())?

You can have up to 10 in your program…

1 Like