added methods to control delay time and updated the README

pull/365/head
Aaron Christianson 7 years ago
parent 48927e5ccf
commit e6f7aef63b

@ -25,18 +25,22 @@ both!) of the effects:
#include <Kaleidoscope-LEDControl.h> #include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-LEDEffect-Rainbow.h> #include <Kaleidoscope-LEDEffect-Rainbow.h>
KALEIDOSCOPE_INIT_PLUGINS(LEDRainbowEffect, LEDRainbowWaveEffect);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
Kaleidoscope.use(&LEDRainbowWaveEffect, &LEDDigitalRainEffect);
LEDRainbowEffect.brightness(150);
LEDRainbowWaveEffect.brightness(150);
LEDRainbowWaveEffect.delay(50);
} }
``` ```
## Plugin methods ## Plugin methods
The plugin provides two objects: `LEDRainbowEffect`, and `LEDRainbowWaveEffect`, The plugin provides two objects: `LEDRainbowEffect`, and `LEDRainbowWaveEffect`,
neither of which have any public methods or properties, outside of those both of which provide methods to set the delay time (animation speed)
provided by all LED modes. and effect brightness, called `delay` and `brightness` respectively.
## Dependencies ## Dependencies

@ -23,6 +23,10 @@ void LEDRainbowEffect::brightness(byte brightness) {
rainbow_value = brightness; rainbow_value = brightness;
} }
void LEDRainbowEffect::delay(byte delay) {
rainbow_update_delay = delay;
}
// --------- // ---------
@ -51,6 +55,10 @@ void LEDRainbowWaveEffect::update(void) {
void LEDRainbowWaveEffect::brightness(byte brightness) { void LEDRainbowWaveEffect::brightness(byte brightness) {
rainbow_value = brightness; rainbow_value = brightness;
} }
void LEDRainbowWaveEffect::delay(byte delay) {
rainbow_update_delay = delay;
}
} }
kaleidoscope::LEDRainbowEffect LEDRainbowEffect; kaleidoscope::LEDRainbowEffect LEDRainbowEffect;

@ -9,6 +9,7 @@ class LEDRainbowEffect : public LEDMode {
LEDRainbowEffect(void) {} LEDRainbowEffect(void) {}
void brightness(byte); void brightness(byte);
void delay(byte);
void update(void) final; void update(void) final;
private: private:
@ -28,6 +29,7 @@ class LEDRainbowWaveEffect : public LEDMode {
LEDRainbowWaveEffect(void) {} LEDRainbowWaveEffect(void) {}
void brightness(byte); void brightness(byte);
void delay(byte);
void update(void) final; void update(void) final;
private: private:

Loading…
Cancel
Save