Library to control NeoPixel strings of RGB leds

Dependencies:   PixelArray

Dependents:   NeoPixelI2cSlave NeoPixelI2cSlave

Revision:
3:7d32f46a38d3
Parent:
1:f544810b6598
diff -r bb9ebad05691 -r 7d32f46a38d3 Effects/strobe_effect.cpp
--- a/Effects/strobe_effect.cpp	Mon Nov 23 21:32:24 2015 +0000
+++ b/Effects/strobe_effect.cpp	Fri Apr 15 14:38:13 2016 +0000
@@ -2,21 +2,22 @@
 
 namespace Effects {
 
-    StrobeEffect::StrobeEffect(NeoPixelString * pixelstring, int delay_ms, neopixel::Pixel initial_color)
-        : Effect(pixelstring, delay_ms) {
+    StrobeEffect::StrobeEffect(NeoPixelString * pixelstring, neopixel::Pixel initial_color, int delay_ms)
+        : PeriodicEffect(pixelstring, initial_color, 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;
+        if (shouldExecute()) {
+            clearExecute();
+            if (current_state == OFF) {
+                getPixelString()->update(getColor());
+                current_state = ON;
+            } else {
+                getPixelString()->update(Colors::Black);
+                current_state = OFF;
+            }
         }
     }