File tree 2 files changed +33
-1
lines changed 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,7 @@ Updated keywords.txt file to include all functions.
19
19
o Replaced a bunch of magic numbers in <Timer.cpp> by the above constants
20
20
o Added several comments
21
21
o Added Timer::pulseImmediate(). pulseImmediate sets the pin to the specified value for the given
22
- duration. After the duration, the pin is set to !value.
22
+ duration. After the duration, the pin is set to !value.
23
+
24
+ 1.2 by Jack Christensen
25
+ o Added "blink2" example illustrating flashing two LEDs at different rates.
Original file line number Diff line number Diff line change
1
+ // Flash two LEDs at different rates using Simon Monk's Timer library
2
+ // http://www.doctormonk.com/2012/01/arduino-timer-library.html
3
+ //
4
+ // Jack Christensen 30Sep2013
5
+ //
6
+ // Beerware license: Free for any and all purposes, but if you find it
7
+ // useful AND we actually meet someday, you can buy me a beer!
8
+
9
+ #include " Timer.h" // http://github.com/JChristensen/Timer
10
+
11
+ const int LED1 = 8 ; // connect one LED to this pin (with appropriate current-limiting resistor of course)
12
+ const int LED2 = 9 ; // connect another LED to this pin (don't forget the resistor)
13
+ const unsigned long PERIOD1 = 1000 ; // one second
14
+ const unsigned long PERIOD2 = 10000 ; // ten seconds
15
+ Timer t; // instantiate the timer object
16
+
17
+ void setup (void )
18
+ {
19
+ pinMode (LED1, OUTPUT);
20
+ pinMode (LED2, OUTPUT);
21
+ t.oscillate (LED1, PERIOD1, HIGH);
22
+ t.oscillate (LED2, PERIOD2, HIGH);
23
+ }
24
+
25
+ void loop (void )
26
+ {
27
+ t.update ();
28
+ }
29
+
You can’t perform that action at this time.
0 commit comments