You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Pretty tiny Scheduler** or **ptScheduler** is a non-preemptive task scheduler library for **Arduino** that helps you to write **non-blocking periodic tasks** easily and effectively without using ordinary delay routines or using `millis()`function on your own.
4
+
**Pretty tiny Scheduler** or **ptScheduler** is a non-preemptive task scheduler and a timing library for **Arduino** that helps you to write **non-blocking periodic tasks** easily and effectively without using ordinary delay routines or using `millis()`or `micros()` functions.
5
5
6
-
You won't have to use **delay()** or **millis()** functions again.
7
-
8
-
Under the hood, ptScheduler uses the native `millis()` implementation. The `millis()` function is a hardware timer based **ISR** that increments a global counter variable (unsigned integer) every millisecond.
6
+
Under the hood, ptScheduler uses the native `micros()` implementation. The `micros()` function is a hardware timer based **ISR** that increments a global counter variable (unsigned integer) every microsecond.
9
7
10
8
When you create a new ptScheduler object, you can specify the **time intervals** and **execution modes**. All the class member variables and functions are public and therefore gives you full control over your tasks, allowing dynamically changing the behavior of the task.
11
9
12
-
To run a task, just enclose the **`call()`** function inside any **conditional statements**, either inside your infinite loop or inside a function. Every time you invoke the `call()` function, it checks if the elapsed time is larger than the preset interval. If yes, it will return `true` and cause the code under the conditional block to be executed once.
10
+
To run a task, just enclose the **`call()`** function inside any **conditional statements**, either inside your infinite loop or inside a function. Every time you invoke the `call()` function, it checks if the elapsed time is larger than the preset interval. If yes, it will return `true` and cause the code under the conditional block to be executed.
13
11
14
-
ptScheduler is good mainly for **control applications** that require the periodic polling of sensors, GPIOs and other IO devices. ptScheduler tasks can coexist with preemptive tasks such as **FreeRTOS** tasks.
12
+
ptScheduler is good for **control applications** that require periodic polling of sensors, GPIOs and other IO devices. ptScheduler tasks can coexist with preemptive tasks such as **FreeRTOS** tasks.
15
13
16
14
## Hello World
17
15
@@ -21,7 +19,7 @@ Here is the basic `Hello World` example.
21
19
#include"ptScheduler.h"
22
20
23
21
//create tasks
24
-
ptScheduler sayHello = ptScheduler(1000);
22
+
ptScheduler sayHello = ptScheduler(1000000); //time in microseconds
0 commit comments