Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- // Relaxing Slow and Smooth scrolling christmas colors to hang in my tree
- #define LED_PIN 5
- #define NUM_LEDS 60
- #define BRIGHTNESS 128
- CRGB leds[NUM_LEDS];
- static const byte hue_arr[6]= {0,64,96,0,64,96};
- static const byte sat_arr[6]= {255,150,255,255,150,255};
- word w;
- void setup() {
- delay( 3000 ); // power-up safety delay
- FastLED.addLeds<NEOPIXEL,LED_PIN>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- FastLED.setDither(0); // flickers if adding a lot of leds
- }
- void loop() {
- EVERY_N_MILLIS(10) {
- FastLED.show();
- }
- EVERY_N_MILLIS(10) {
- w++;
- if (w>768) w=0;
- byte p=0;
- for(byte i=0;i<NUM_LEDS;i++) {
- p++;
- if (p>23) p=0;
- leds[i]=CHSV(hue_arr[((w>>5)+p)>>3],sat_arr[((w>>5)+p)>>3],sin8((i<<5)+w-32));
- leds[i]+=leds[i];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement