Simple library for controlling LEDs. Turn them on & off, blink them at specified rates and toggle their output. Don't forget to add a timer for the LEDs to use. Documentation found in header file.
Diff: LEDControl.cpp
- Revision:
- 1:1f6bd61833a3
- Parent:
- 0:8aa281e74b4a
diff -r 8aa281e74b4a -r 1f6bd61833a3 LEDControl.cpp --- a/LEDControl.cpp Thu Jul 09 13:07:50 2015 +0000 +++ b/LEDControl.cpp Fri Jul 31 18:15:08 2015 +0000 @@ -11,9 +11,15 @@ void LEDControl::blink(float rate) { long _currentTime = _Time->read_ms(); + + if(_nextBlink - _currentTime > 5000) + { + _nextBlink = 0; + } + if(_currentTime - _nextBlink > 0) { - if(_currentTime > 20000000) + if(_currentTime > 30000) { _Time->reset(); _currentTime = 0;