From 2246f3bcf51cea78550bd181d7589f8075043175 Mon Sep 17 00:00:00 2001 From: brimshot Date: Thu, 25 Jun 2020 21:50:02 -0400 Subject: [PATCH] remove unused files --- examples/bulb_lights/bulb_lights.ino | 183 ------------------------- examples/flat_strip/flat_strip.ino | 192 --------------------------- examples/flat_strip/popupDroid.h | 100 -------------- 3 files changed, 475 deletions(-) delete mode 100644 examples/bulb_lights/bulb_lights.ino delete mode 100644 examples/flat_strip/flat_strip.ino delete mode 100644 examples/flat_strip/popupDroid.h diff --git a/examples/bulb_lights/bulb_lights.ino b/examples/bulb_lights/bulb_lights.ino deleted file mode 100644 index 06bfb6d..0000000 --- a/examples/bulb_lights/bulb_lights.ino +++ /dev/null @@ -1,183 +0,0 @@ -/***************************************************** - -MIT License - -Copyright (c) 2020 Chris Brim - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*****************************************************/ - - -/************* -Demo reel using the quickPatterns library - -These are examples that tend to look better on bulb style lights, making use of wave animations -**************/ - -#include -#include -#include - -#define CHIPSET WS2811 -#define DATA_PIN 8 -#define NUM_LEDS 100 -#define BRIGHTNESS 32 -#define COLOR_ORDER RGB //GRB for WS2812, RGB for WS2811 - -#define TICKLENGTH 25 - -//Declare master set of leds for FastLED to write to -CRGB leds[NUM_LEDS]; - -quickPatterns quickPatterns(leds, NUM_LEDS); //NUM_STRIPS*NUM_LEDS_PER_STRIP); -void setup() { - - delay(3000); // Recovery delay - - // ~ Configure FastLED - - FastLED.addLeds(leds, NUM_LEDS) - .setCorrection(TypicalLEDStrip) - .setDither(BRIGHTNESS < 255); - - - FastLED.setBrightness(BRIGHTNESS); - FastLED.setMaxPowerInVoltsAndMilliamps(5, 450); - - FastLED.clear(); - - - // ~ Configure quickPatterns - - // Due to a potential latching issue when writing data, we use a hard delay for timing with the ESP8266 - #ifdef ESP8266 - quickPatterns.setTickMillis(0); - #endif - - #ifndef ESP8266 - quickPatterns.setTickMillis(TICKLENGTH); - #endif - - // ~ Scene 0 - demonstrates simultaneous patterns, timed activation and two options for dynamically changing colors - - // Each call to addPattern() automatically creates a new 'layer' on which that pattern is rendered which we can use to combine, blend and time independently - - // sine wave that moves back and forth along the strip rainbow palette sequentially - quickPatterns.addPattern(new qpSinelon(16)) - .chooseColorSequentiallyFromPalette(RainbowColors_p) - .changeColorEveryNTicks(2); - // The sameLayer() function returns a reference to the last layer accessed. We are going to continually fade this layer's light such that old pixels fade away once rendered. Fade values are from 0-255 - quickPatterns.sameLayer().continuallyFadeLayerBy(20); - - // create a color set - CRGB *pulseColors = new CRGB[3]; - pulseColors[0] = CRGB::Blue; - pulseColors[1] = CRGB::Yellow; - pulseColors[2] = CRGB::Pink; - - // small line of pixels that bounces back and forth - quickPatterns.addPattern(new qpBouncingPulse(8)) - .chooseColorSequentiallyFromSet(pulseColors, 3) - .changeColorEveryNCycles(4); - - // randomly activated lightning flashes - quickPatterns.addPattern(new qpFlashRandomSection(10)) - .singleColor(CRGB::White) - .activatePeriodicallyEveryNTicks(100, 200) - .stayActiveForNCycles(2, 4); - - - // ~ Scene 1 - demonstrates timed activation and duration - - // juggle effect base layer - quickPatterns.newScene().addPattern(new qpJuggle()) - .chooseColorSequentiallyFromPalette(ForestColors_p) - .changeColorEveryNTicks(10) - .drawEveryNTicks(4); //slowing down our updates gives a wider spread to the juggle effect - quickPatterns.sameLayer().continuallyFadeLayerBy(20); - - // sine wave activated randomly at intervals between 80 and 150 ticks. once active, stays active for 50 ticks. changes from blue to purple - quickPatterns.sameScene().addPattern(new qpBouncingPulse(20)) - .chooseColorSequentiallyFromPalette(CRGBPalette16(CRGB::Blue, CRGB::Purple)) - .changeColorEveryNTicks(1) - .activatePeriodicallyEveryNTicks(80, 150) - .stayActiveForNCycles(4); - quickPatterns.sameLayer().continuallyFadeLayerBy(20).setLayerBrush(ADD); - - // periodic yellow feathers - quickPatterns.sameScene().addPattern(new qpRandomBar(10)) - .singleColor(CRGB::Yellow) - .activatePeriodicallyEveryNTicks(160) - .drawEveryNTicks(10) - .stayActiveForNFrames(5); - quickPatterns.sameLayer().continuallyFadeLayerBy(20).setLayerBrush(COMBINE); - - - // ~ Scene 2 - demonstrates the MASK brush - - // rainbow gradient base layer - quickPatterns.newScene().addPattern(new qpMovingGradient(RainbowColors_p)); - - // soft white confetti. Using the ADD brush to add this layers light to what's below which gives a popping sparkle effect and will leave sparkles as the mask fades - quickPatterns.sameScene().addPattern(new qpConfetti()) - .singleColor(CRGB::White) - .drawEveryNTicks(4); - quickPatterns.sameLayer().continuallyFadeLayerBy(30).setLayerBrush(ADD); - - // feather mask periodically illuminates the strand in sections - quickPatterns.sameScene().addPattern(new qpFeathers(10)) - .singleColor(CRGB::White) - .drawEveryNTicks(3) - .activatePeriodicallyEveryNTicks(50, 200) - .stayActiveForNCycles(1); - quickPatterns.sameLayer().setLayerBrush(MASK).continuallyFadeLayerBy(10); - - // small pink runner on top - quickPatterns.sameScene().addPattern(new qpBouncingPulse(5)) - .singleColor(CRGB::HotPink); - - - // ~ Scene 3 - demonstrates periodic pattern activation - - //stop and go rainbow theater chase - quickPatterns.newScene().addPattern(new qpTheaterChase()) - .drawEveryNTicks(3) - .chooseColorSequentiallyFromPalette(RainbowColors_p) - .changeColorEveryNTicks(6) - .activatePeriodicallyEveryNTicks(25, 75) - .stayActiveForNTicks(25, 75); - -} - - -void loop() -{ - - quickPatterns.draw(); - FastLED.show(); - - #ifdef ESP8266 - FastLED.delay(TICKLENGTH); - #endif - - EVERY_N_SECONDS(30) { - quickPatterns.nextScene(); - } - -} diff --git a/examples/flat_strip/flat_strip.ino b/examples/flat_strip/flat_strip.ino deleted file mode 100644 index f906cf7..0000000 --- a/examples/flat_strip/flat_strip.ino +++ /dev/null @@ -1,192 +0,0 @@ -/***************************************************** - -quickPatterns demo reel - -MIT License - -Copyright (c) 2020 Chris Brim - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*****************************************************/ - -#include -#include -#include "popupDroid.h" - -#define CHIPSET WS2812 -#define DATA_PIN 8 // pin 11 is hardware SPI on Teensy 3.x and ATMega328P based Arduino -#define NUM_LEDS 100 -#define BRIGHTNESS 32 -#define COLOR_ORDER GRB //GRB for WS2812, RGB for WS2811 - -#define TICKLENGTH 25 - -//Declare master set of leds for FastLED to write to -CRGB leds[NUM_LEDS]; - -//Declare quickPatterns controller and pass in led data -quickPatterns quickPatterns(leds, NUM_LEDS); //NUM_STRIPS*NUM_LEDS_PER_STRIP); - - -void setup() { - - delay(3000); // Recovery delay - - // ~ Configure FastLED - - FastLED.addLeds(leds, NUM_LEDS) - .setCorrection(TypicalLEDStrip) - .setDither(BRIGHTNESS < 255); - - FastLED.setBrightness(BRIGHTNESS); - FastLED.setMaxPowerInVoltsAndMilliamps(5, 450); - - FastLED.clear(); - - - // ~ Configure quickPatterns - - // Due to a potential latching issue when writing data, we use a hard delay for timing with the ESP8266 - #ifdef ESP8266 - quickPatterns.setTickMillis(0); - #endif - - #ifndef ESP8266 - quickPatterns.setTickMillis(TICKLENGTH); - #endif - - - // ~ Scene 0 - demonstrates running simultaneous patterns at differing speeds, the same bouncing bars pattern with 3 different configurations will weave in and out of sync - - // Each call to addPattern() automatically creates a new 'layer' on which that pattern is rendered which we can use to combine, blend and time independently - - // blue bars, 9 pixels width - quickPatterns.addPattern(new qpBouncingBars(9)) - .singleColor(CRGB::Blue); - - // short red bars, 5 pixels - quickPatterns.addPattern(new qpBouncingBars(5)) - .singleColor(CRGB::Red); - quickPatterns.sameLayer().setLayerBrush(ADD); //when passing over underlying pixels, add their light together - - // slow yellow bars, 5 pixels - quickPatterns.addPattern(new qpBouncingBars(5)) - .singleColor(CRGB::Yellow) - .drawEveryNTicks(3); //move at a slower speed - quickPatterns.sameLayer().setLayerBrush(COMBINE); - - - // ~ Scene 1 - demonstrates a use of state machine patterns - - // "popupDroid" is a little state machine that flashes a few times then moves randomly up and down the strand before disappearing - - //yellow version, 16 pixels, less frequent, on the lowest layer, activates randomly at 200 - 400 tick intervals - quickPatterns.newScene().addPattern(new popupDroid(16)) - .singleColor(CRGB::Yellow) - .activatePeriodicallyEveryNTicks(200, 400) - .stayActiveForNCycles(1); - - //red version, 8 pixels, randomly every 20 to 70 ticks - quickPatterns.sameScene().addPattern(new popupDroid(8)) - .singleColor(CRGB::Red) - .activatePeriodicallyEveryNTicks(20, 70) - .stayActiveForNCycles(1); - - //blue version, 8 pixels, randomly every 20 to 70 ticks - quickPatterns.sameScene().addPattern(new popupDroid(8)) - .singleColor(CRGB::Blue) - .activatePeriodicallyEveryNTicks(20, 70) - .stayActiveForNCycles(1); - quickPatterns.sameLayer().setLayerBrush(ADD); - - - // ~ Scene 2 - - // sine wave that moves back and forth along the strip rainbow palette sequentially - quickPatterns.newScene().addPattern(new qpSinelon(16)) - .chooseColorSequentiallyFromPalette(RainbowColors_p) - .changeColorEveryNTicks(2); - // The sameLayer() function returns a reference to the last layer accessed. We are going to continually fade this layer's light such that old pixels fade away once rendered. Fade values are from 0-255 - quickPatterns.sameLayer().continuallyFadeLayerBy(20); - - // create a color set - CRGB *pulseColors = new CRGB[3]; - pulseColors[0] = CRGB::Blue; - pulseColors[1] = CRGB::Yellow; - pulseColors[2] = CRGB::Pink; - - // small line of pixels that bounces back and forth - quickPatterns.sameScene().addPattern(new qpBouncingPulse(8)) - .chooseColorSequentiallyFromSet(pulseColors, 3) - .changeColorEveryNCycles(4); - - // randomly activated lightning flashes - quickPatterns.sameScene().addPattern(new qpFlashRandomSection(10)) - .singleColor(CRGB::White) - .activatePeriodicallyEveryNTicks(100, 200) - .stayActiveForNCycles(2, 4); - - - // ~ Scene 3 - demonstrates the use of the SUBTRACT brush to animate with negative space - - quickPatterns.newScene().addPattern(new qpTheaterChase()) - .drawEveryNTicks(3) - .chooseColorSequentiallyFromPalette(RainbowColors_p) - .changeColorEveryNTicks(6); - - quickPatterns.sameScene().addPattern(new qpBouncingBars(8)) - .singleColor(CRGB::White); - quickPatterns.sameLayer().setLayerBrush(SUBTRACT); //subtracting white pixels turns off whatever is below - - - // ~ Scene 4 - demonstrates the MASK brush - - // moving rainbow gradient base layer - quickPatterns.newScene().addPattern(new qpMovingGradient(RainbowColors_p)); - - // soft white confetti. Use the ADD brush to add this layers light to what's below to give a sparkle effect on the rainbow - quickPatterns.sameScene().addPattern(new qpConfetti()) - .singleColor(CRGB::White) - .drawEveryNTicks(4); - quickPatterns.sameLayer().continuallyFadeLayerBy(20).setLayerBrush(ADD); - - // create a moving visible window into below patterns using the mask brush - quickPatterns.sameScene().addPattern(new qpWanderingLine(30)) - .singleColor(CRGB::White); - quickPatterns.sameLayer().setLayerBrush(MASK); - -} - - -void loop() -{ - - quickPatterns.draw(); - FastLED.show(); - - //On ESP8266 boards due to FastLED latching / write issue, we set our 'tick' length to 0 (see above) and manage the global update speed via hard delay - #ifdef ESP8266 - FastLED.delay(TICKLENGTH); - #endif - - EVERY_N_SECONDS(30) { - quickPatterns.nextScene(); - } - -} diff --git a/examples/flat_strip/popupDroid.h b/examples/flat_strip/popupDroid.h deleted file mode 100644 index fedccb5..0000000 --- a/examples/flat_strip/popupDroid.h +++ /dev/null @@ -1,100 +0,0 @@ - -class popupDroid : public qpPattern { - - private: - enum {POPUP, GO} state = POPUP; - - bool clearEachCycle = true; - byte size = 0; - uint16_t startPos = 0; - int dir = 1; - - //popup state - byte numFlashes = 8; - byte flashSteps = 0; - - //go state - byte goMoves = 0; - byte goDist = 0; - - private: - - void reset() { - this->flashSteps = numFlashes*2; - this->startPos = random16(0, (_numLeds - this->size)); - this->state = POPUP; - } - - void changeDirection() { - this->dir *= -1; - } - - public: - - popupDroid(int size = 6, bool clearEachCycle = true) { - this->size = size; - this->clearEachCycle = clearEachCycle; - - } - - void initialize() { - this->reset(); - } - - - void draw() { - - _clearLeds(); - - switch(this->state) { - case POPUP: - this->doPOPUP(); - break; - case GO: - this->doGO(); - break; - } - - } - - - void doPOPUP() { - for(int i = 0; i < this->size; i++) { - if(this->flashSteps%2) - _targetLeds[(this->startPos+i)] = _getColor(); - else - _targetLeds[(this->startPos+i)] = CRGB::Black; - } - - //init GO here - if(--this->flashSteps <= 0) { - this->state = GO; - this->goMoves = random16(4, 8); - this->goDist = random(this->size, (_numLeds / 2)); - } - } - - void doGO() { - - for(int i = 0; i < this->size; i++) { - if(_inBounds(this->startPos+i)) - _targetLeds[(this->startPos+i)] = _getColor(); - } - - this->startPos += this->dir; - - if(!_inBounds(this->startPos+this->size) || (--this->goDist <= 0)) { - if(--this->goMoves <= 0) { - this->reset(); - if(this->clearEachCycle) - _clearLeds(); - - _countCycle(); - } - this->goDist = random(this->size, (_numLeds / 2)); - this->changeDirection(); - } - - } - -};