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 44 Demonstrates the use of the Scheduler library
55
66 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
88
99 created 28 Dic 2015
1010 by Testato
1515// Include Scheduler since we want to manage multiple tasks.
1616#include < Scheduler.h>
1717
18+ #define LED1 13
19+ #define LED2 10
20+ #define LED3 11
1821byte counter1;
1922byte counter2;
20- byte led1 = 10 ;
21- byte led2 = 11 ;
2223
2324
2425void setup () {
2526
2627 // 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);
2931
3032 // Add "loop2 and loop3" to scheduler
3133 // "loop" is always started by default
@@ -36,7 +38,14 @@ void setup() {
3638
3739// Task no.1 (standard Arduino loop() )
3840void 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()
4049}
4150
4251
You can’t perform that action at this time.
0 commit comments