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