Library to control NeoPixel strings of RGB leds
Dependents: NeoPixelI2cSlave NeoPixelI2cSlave
Diff: Effects/strobe_effect.cpp
- Revision:
- 1:f544810b6598
- Child:
- 3:7d32f46a38d3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Effects/strobe_effect.cpp Mon Nov 23 18:50:01 2015 +0000 @@ -0,0 +1,23 @@ +#include "strobe_effect.h" + +namespace Effects { + + StrobeEffect::StrobeEffect(NeoPixelString * pixelstring, int delay_ms, neopixel::Pixel initial_color) + : Effect(pixelstring, delay_ms) { + + this->initial_color = initial_color; + current_state = OFF; + } + + void StrobeEffect::execute(void) { + Effect::execute(); + if (current_state == OFF) { + getPixelString()->update(initial_color); + current_state = ON; + } else { + getPixelString()->update(Colors::Black); + current_state = OFF; + } + } + +}; \ No newline at end of file