Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 144
- #define DATA_PIN 6
- #define TICK_DELAY_MILLISECONDS 20
- //define some color names
- CRGB pink = CRGB(255,20,140);
- CRGB yellow = CRGB(255,218,0);
- CRGB blue = CRGB(5,174,255);
- CRGB gflux1 = CRGB(246,118,149);
- CRGB gflux2 = CRGB(242,161,184);
- CRGB gflux3 = CRGB(206,204,204);
- CRGB gflux4 = CRGB(121,223,246);
- CRGB gflux5 = CRGB(255,244,138);
- CRGB white = CRGB(255,255,255);
- CRGB lgray = CRGB(100,100,100);
- CRGB dgray = CRGB(50,50,50);
- CRGB black = CRGB(25,25,25);
- CRGB brown = CRGB(60,60,30);
- CRGB off = CRGB(0,0,0);
- CRGB red = CRGB(255,0,0);
- CRGB orange = CRGB(255, 140, 0);
- CRGB green = CRGB(0,255,50);
- CRGB purple = CRGB(255,0,255);
- //define your pattern
- #define num_segments 68
- #define segmentLength 4
- static CRGB segments[num_segments] ={
- blue,
- blue,
- pink,
- pink,
- white,
- white,
- pink,
- pink,
- blue,
- blue,
- off,
- off,
- off,
- pink,
- pink,
- pink,
- yellow,
- yellow,
- yellow,
- blue,
- blue,
- blue,
- off,
- off,
- off,
- pink,
- pink,
- gflux3,
- gflux3,
- blue,
- blue,
- yellow,
- yellow,
- off,
- off,
- off,
- black,
- brown,
- red,
- orange,
- yellow,
- green,
- blue,
- purple,
- off,
- off,
- off,
- dgray,
- lgray,
- pink,
- white,
- pink,
- lgray,
- dgray,
- off,
- off,
- off,
- yellow,
- yellow,
- white,
- white,
- purple,
- purple,
- black,
- black,
- off,
- off,
- off
- };
- int cur_seg_num = 0;
- int cur_seg_prog = 0;
- CRGB led_active[NUM_LEDS];
- void setup() {
- FastLED.addLeds<NEOPIXEL, DATA_PIN>(led_active, NUM_LEDS);
- FastLED.setBrightness(60);
- }
- void loop() {
- digitalWrite(13,(cur_seg_num == 0? LOW:HIGH));
- for (int i = NUM_LEDS - 1; i > 0; i--) {
- //push each value forward by one
- led_active[i] = led_active[i-1];
- }
- //set first led to new color, and incriment the variable we're copyign from
- led_active[0] = segments[cur_seg_num];
- if(++cur_seg_prog >= segmentLength){
- cur_seg_num++;
- cur_seg_num %= num_segments;
- cur_seg_prog = 0;
- }
- // led_active[0] = brown;
- //update the strand and wait
- FastLED.show();
- delay(TICK_DELAY_MILLISECONDS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement