Library to control NeoPixel strings of RGB leds

Dependencies:   PixelArray

Dependents:   NeoPixelI2cSlave NeoPixelI2cSlave

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers strobe_effect.cpp Source File

strobe_effect.cpp

00001 #include "strobe_effect.h"
00002 
00003 namespace Effects {
00004 
00005     StrobeEffect::StrobeEffect(NeoPixelString * pixelstring, neopixel::Pixel initial_color, int delay_ms)
00006         : PeriodicEffect(pixelstring, initial_color, delay_ms) {
00007     
00008         current_state = OFF;
00009     }
00010     
00011     void StrobeEffect::execute(void) {
00012         if (shouldExecute()) {
00013             clearExecute();
00014             if (current_state == OFF) {
00015                 getPixelString()->update(getColor());
00016                 current_state = ON;
00017             } else {
00018                 getPixelString()->update(Colors::Black);
00019                 current_state = OFF;
00020             }
00021         }
00022     }
00023 
00024 };