Skip to content

Commit 9cedd44

Browse files
committed
Update 1.start.md
1 parent 2333705 commit 9cedd44

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

docs/1.start.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,37 @@ LP_TIMER(1000, []() {
229229
LP_TIMER_("tmr", 100, []() {
230230
Serial.println(millis());
231231
});
232+
```
233+
234+
### Многофайловый проект
235+
Глобальный диспетчер задач позволяет создавать задачи в отдельных исполняемых файлах и не тащить их в main, но они всё равно будут вызываться из общего loop в main. Например
236+
237+
```cpp
238+
// main.cpp
239+
#include <Arduino.h>
240+
#include <Looper.h>
241+
242+
void setup() {
243+
}
244+
void loop() {
245+
Looper.loop();
246+
}
247+
248+
249+
// main1.cpp
250+
#include <Arduino.h>
251+
#include <Looper.h>
252+
253+
LP_TASK([]() {
254+
// loop code
255+
});
256+
257+
258+
// main2.cpp
259+
#include <Arduino.h>
260+
#include <Looper.h>
261+
262+
LP_TASK([]() {
263+
// loop code
264+
});
232265
```

0 commit comments

Comments
 (0)