Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This code was created from multiple sources but partially based on:
- // Matrix
- //By: funkboxing LED
- //Modified by: Andrew Tuling //Date: Oct, 2014
- #include "FastLED.h" // FastLED library.
- #define NUM_LED_STRIP_1 37
- #define NUM_LED_STRIP_2 37 //Led Strips can be of differant lengths
- #define NUM_LED_STRIP_3 27
- #define NUM_LEDS_TOTAL 74
- #define BRIGHTNESS 125
- #define LED_PIN_A 6
- #define LED_PIN_B 4 // Choose a pin for each strip
- #define LED_PIN_C 8
- #define UPDATES_PER_SECOND 50 // Set Speed
- #define LED_TYPE WS2812B
- CRGB ledsA[NUM_LED_STRIP_1];
- CRGB ledsB[NUM_LED_STRIP_2];
- CRGB ledsC[NUM_LED_STRIP_3];
- uint8_t max_bright = 200;
- //Settings for Strip A "bounce" variables for this Segment ////////////////////////////////////////////////
- int thisdelay = 120; // A delay value for sequence(A)
- int thishue = 95; //Starting Color
- int thissat = 255;
- int thisdir = 0;
- bool huerot = 1; // Does the hue rotate? 1 = yes, 0= single color
- uint8_t bgclr = 0;
- uint8_t bgbri = 0;
- //Settings for Strip B "text" variables for this Segment ///////////////////////////////////////////////////
- int thisdelay2 = 100; // A delay value for sequence(B)
- int thishue2 = 8; //Starting Color
- int thissat2 = 200;
- int thisdir2 = 0;
- bool huerot2 = 1; // Does the hue rotate? 1 = yes, 0= single color
- uint8_t bgclr2 = 0;
- uint8_t bgbri2 = 0;
- //Settings for Strip C "logo" variables for this Segment//////////////////////////////////////////////////////
- int thisdelay3 = 40; // A delay value for sequence(C)
- int thishue3 = 0; //Starting Color
- int thissat3 = 100;
- int thisdir3 = 0;
- bool huerot3 = 0; // Does the hue rotate? 1 = yes, 0= single color
- uint8_t bgclr3 = 30;
- uint8_t bgbri3 = 50;
- void setup() { //////////////////////////////////////////////////////////////////////////////////////////////////
- delay( 3000 ); // power-up safety delay
- FastLED.addLeds<LED_TYPE, LED_PIN_A, GRB>(ledsA, NUM_LED_STRIP_1);
- FastLED.addLeds<LED_TYPE, LED_PIN_B, GRB>(ledsB, NUM_LED_STRIP_2);
- FastLED.addLeds<LED_TYPE, LED_PIN_C, GRB>(ledsC, NUM_LED_STRIP_3);
- FastLED.setBrightness(max_bright);
- }
- void loop () { /////////////////////////////////////////////////////////////////////////////////////////////////////
- EVERY_N_MILLISECONDS(thisdelay) { // FastLED based non-blocking delay to update/display the sequence.
- bounce(); // bounce section = ledsA Strip 1.
- }
- EVERY_N_MILLISECONDS(thisdelay2 ) { // FastLED based non-blocking delay to update/display the sequence.
- text(); // text section = ledsB, Strip 2.
- }
- EVERY_N_MILLISECONDS(thisdelay3 ) { // FastLED based non-blocking delay to update/display the sequence.
- logo(); // logo section = ledsC, Strip 3.
- }
- FastLED.show();
- } // loop()
- void bounce() { ////////////////////////////////////////////////////////////////////////////////////////////////
- if (huerot) thishue=thishue-5;
- if (random16(80) > 72) {
- if (thisdir == 0) ledsA[0] = CHSV(thishue, thissat, 255);
- else ledsB[NUM_LED_STRIP_1-1] = CHSV(thishue, thissat, 255);
- }
- else {
- if (thisdir == 0) ledsA[0] = CHSV(bgclr, thissat, bgbri);
- else ledsB[NUM_LED_STRIP_1-1] = CHSV(bgclr, thissat, bgbri);
- }
- if (thisdir == 0) {
- for (int i = NUM_LED_STRIP_1-1; i >0 ; i-- ) ledsA[i] = ledsA[i-1];
- } else {
- for (int i = 0; i < NUM_LED_STRIP_1-1 ; i++ ) ledsA[i] = ledsA[i+1];
- }
- }
- void text() { ///////////////////////////////////////////////////////////////////////////////////////////////////////
- if (huerot2) thishue2=thishue2-1;
- if (random8(80) > 70) {
- if (thisdir2 == 0) ledsB[0] = CHSV(thishue2, thissat2, 255);
- else ledsB[NUM_LED_STRIP_2-1] = CHSV(thishue2, thissat2, 255);
- }
- // else {
- //if (thisdir2 == 0) ledsB[0] = CHSV(bgclr2, thissat2, bgbri2);
- //else ledsB[NUM_LED_STRIP_2-1] = CHSV(bgclr2, thissat2, bgbri2);
- // }
- if (thisdir2 == 0) {
- for (int i = NUM_LED_STRIP_2-1; i >0 ; i-- ) ledsB[i] = ledsB[i-1];
- } else {
- for (int i = 0; i < NUM_LED_STRIP_2-1 ; i++ ) ledsB[i] = ledsB[i+1];
- }
- }
- void logo() { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- if (huerot3) thishue3=thishue3-1;
- if (random16(80) > 70) {
- if (thisdir3 == 0) ledsC[0] = CHSV(thishue3, thissat3, 255);
- else ledsC[NUM_LED_STRIP_3-1] = CHSV(thishue3, thissat3, 255);
- }
- else {
- if (thisdir3 == 0) ledsC[0] = CHSV(bgclr3, thissat3, bgbri3);
- else ledsC[NUM_LED_STRIP_3-1] = CHSV(bgclr3, thissat3, bgbri3);
- }
- if (thisdir3 == 0) {
- for (int i = NUM_LED_STRIP_3-1; i >0 ; i-- ) ledsC[i] = ledsC[i-1];
- } else {
- for (int i = 0; i < NUM_LED_STRIP_3-1 ; i++ ) ledsC[i] = ledsC[i+1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment