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
Copy file name to clipboardExpand all lines: README.md
+7-20Lines changed: 7 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ started (in what time since now) and how many times they should be invoked
12
12
(only once, X times or forever).
13
13
14
14
The "co-operation" is best achieved by creating small, short running tasks.
15
-
Basically wherever you'd need to include the infamous *delay()* call in your Arduino program
15
+
Basically wherever you'd need to include the infamous <code>delay()</code> call in your Arduino program
16
16
that's the place where you actually want to break the code flow, split
17
17
the source code into separate functions and let Tasker run them as separate tasks.
18
18
@@ -31,8 +31,12 @@ illustrates the whole API and its best usage.
31
31
ChangeLog
32
32
---------
33
33
* version 1.1 adds clear example of DS18B20 handling
34
+
34
35
* version 1.2 adds optional priorities when defining tasks
35
36
37
+
* version 1.3 removes the <code>run()</code> function - please call <code>tasker.loop()</code> in your Arduino <code>loop()</code> function instead. This makes **Tasker** much more Arduino friendly and compatible with far more platforms where the Arduino 'kernel' does some housekeeping behind the scenes and needs the <code>loop()</code> to be running for it. It also allowed me to remove the <code>yield()</code> call that didn't really bring anything but issues in compiling on some platforms.
38
+
39
+
36
40
How to use
37
41
----------
38
42
@@ -70,24 +74,8 @@ Tasker API
70
74
May pass the <code>optional_int</code> parameter into the called function.
71
75
When the task finishes (after its last iteration) its Tasker slot is made available for new tasks.
72
76
73
-
* <code>run()</code> when called it starts the Tasker scheduler and will never return.
74
-
Best to be called as the very last command of the Arduino's <code>setup()</code> function:
75
-
76
-
```cpp
77
-
void setup() {
78
-
tasker.setInterval(...);
79
-
tasker.run(); // will not return
80
-
}
81
-
82
-
void loop() {
83
-
// unused, never called
84
-
}
85
-
```
86
-
87
-
* optional: if you, for whatever reason, don't want to let the <code>Tasker.run()</code>
88
-
govern all of your running code and wish to run Tasker together with some
89
-
existing code you can omit the <code>run()</code> and call the <code>Tasker.loop()</code>
90
-
repeatedly instead.
77
+
* <code>loop()</code> when called it runs the Tasker scheduler and process all waiting tasks, then ends.
78
+
Best to be called as often as possible, ideally in the Arduino's <code>loop()</code> function:
91
79
92
80
```cpp
93
81
void setup() {
@@ -96,7 +84,6 @@ Tasker API
96
84
97
85
void loop() {
98
86
tasker.loop(); // needs to be called as often as possible
0 commit comments