Library to control NeoPixel strings of RGB leds
Dependents: NeoPixelI2cSlave NeoPixelI2cSlave
Diff: Effects/periodic_effect.cpp
- Revision:
- 3:7d32f46a38d3
diff -r bb9ebad05691 -r 7d32f46a38d3 Effects/periodic_effect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Effects/periodic_effect.cpp Fri Apr 15 14:38:13 2016 +0000 @@ -0,0 +1,25 @@ +#include "periodic_effect.h" + +namespace Effects { + + PeriodicEffect::PeriodicEffect(NeoPixelString * pixelstring, neopixel::Pixel color, int delay_ms) + : Effect(pixelstring, color) { + + this->delay_ms = delay_ms; + } + + void PeriodicEffect::start(void) { + Effect::start(); + ticker.attach(this, &PeriodicEffect::tick, delay_ms/1000.0); + } + + void PeriodicEffect::stop(void) { + Effect::stop(); + ticker.detach(); + } + + void PeriodicEffect::tick(void) { + requestExecute(); + } + +}; \ No newline at end of file