Library to control NeoPixel strings of RGB leds

Dependencies:   PixelArray

Dependents:   NeoPixelI2cSlave NeoPixelI2cSlave

Effects/strobe_effect.cpp

Committer:
dwini
Date:
2016-04-15
Revision:
3:7d32f46a38d3
Parent:
1:f544810b6598

File content as of revision 3:7d32f46a38d3:

#include "strobe_effect.h"

namespace Effects {

    StrobeEffect::StrobeEffect(NeoPixelString * pixelstring, neopixel::Pixel initial_color, int delay_ms)
        : PeriodicEffect(pixelstring, initial_color, delay_ms) {
    
        current_state = OFF;
    }
    
    void StrobeEffect::execute(void) {
        if (shouldExecute()) {
            clearExecute();
            if (current_state == OFF) {
                getPixelString()->update(getColor());
                current_state = ON;
            } else {
                getPixelString()->update(Colors::Black);
                current_state = OFF;
            }
        }
    }

};