Created
January 26, 2018 17:22
-
-
Save jbobrow/4a917ae53d3d55cef7f2570c3904a511 to your computer and use it in GitHub Desktop.
Blinks Timer example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * How to use timers | |
| * | |
| * by Jonathan Bobrow | |
| * 1.25.2018 | |
| */ | |
| #include "blinklib.h" | |
| Timer alarm; | |
| void setup() { | |
| // put your setup code here, to run once: | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| if(buttonSingleClicked()) { | |
| alarm.set(5000); | |
| } | |
| if(alarm.isRunning()) { | |
| setColor(OFF); // clear the display | |
| setFaceColor((millis()/100) % 6, RED); // animate in a circle | |
| } | |
| if(alarm.isComplete()) { | |
| setColor(OFF); // turn off the display | |
| alarm.stop(); // stop the timer | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment