File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Multiple Sketch
3+
4+ Demonstrates the use of .start and .startLoop method of the Scheduler library
5+
6+ Hardware required :
7+ * LEDs connected to pins
8+
9+ created 07 Gen 2016
10+ by Testato
11+
12+ */
13+
14+
15+ // Include Scheduler since we want to manage multiple tasks.
16+ #include < Scheduler.h>
17+
18+ #define LED1 13
19+ #define LED2 10
20+ #define LED3 11
21+
22+
23+ // Sketch no.1
24+
25+ void setup () {
26+ // Setup the led pin as OUTPUT
27+ pinMode (LED1, OUTPUT);
28+
29+ // Add "setup2 and setup3" to scheduler
30+ Scheduler.start (setup2);
31+ Scheduler.start (setup3);
32+ // Add "loop2 and loop3" to scheduler
33+ Scheduler.startLoop (loop2);
34+ Scheduler.startLoop (loop3);
35+ }
36+
37+
38+ void loop () {
39+ digitalWrite (LED1, HIGH);
40+ delay (1000 );
41+ digitalWrite (LED1, LOW);
42+ delay (1000 );
43+
44+ // When multiple tasks are running, 'delay' passes control to
45+ // other tasks while waiting and guarantees they get executed
46+ // It is not necessary to call yield() when using delay()
47+ }
48+
49+
50+
51+
You can’t perform that action at this time.
0 commit comments