Library to control NeoPixel strings of RGB leds

Dependencies:   PixelArray

Dependents:   NeoPixelI2cSlave NeoPixelI2cSlave

Revision:
1:f544810b6598
Child:
3:7d32f46a38d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Effects/effect.cpp	Mon Nov 23 18:50:01 2015 +0000
@@ -0,0 +1,38 @@
+#include "effect.h"
+
+namespace Effects {
+    
+    Effect::Effect(NeoPixelString * pixelstring, int delay_ms) {
+        this->pixelstring = pixelstring;
+        this->delay_ms = delay_ms;
+    
+        execute_effect = false;
+    }
+    
+    NeoPixelString * Effect::getPixelString(void) {
+        return this->pixelstring;
+    }
+    
+    void Effect::start(void) {
+        execute_effect = false;
+        ticker.attach(this, &Effect::tick, delay_ms/1000.0);
+    }
+    
+    void Effect::stop(void) {
+        ticker.detach();
+        execute_effect = false;
+    }
+    
+    void Effect::tick(void) {
+        execute_effect = true;
+    }
+    
+    void Effect::execute(void) {
+        execute_effect = false;
+    }
+    
+    bool Effect::needsExecutionTime(void) {
+        return execute_effect;
+    }
+
+};
\ No newline at end of file