-
Notifications
You must be signed in to change notification settings - Fork 0
/
rainbow_wave.ino
22 lines (17 loc) · 1.02 KB
/
rainbow_wave.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <FastLED.h>
#define PIN 4 // Connect this to the data pin of the LED strip
#define NUM_LEDS 60 // Number of LED in the strip
#define BRIGHTNESS 255 // min = 0, max = 255
#define SATURATION 255 // min = 0, max = 255
CRGB leds[NUM_LEDS]; //leds is an array of size NUM_LEDS and used for addressing the LEDs in the strip
void setup(){
FastLED.addLeds<WS2812B, PIN, GRB>(leds, NUM_LEDS); //< LED type, Data pin, RGB order(optional) >
}
void loop(){
const int k = NUM_LEDS - 1;
for(int j = 0; j < 255; j++){
for (int i = 0; i< NUM_LEDS; i++) // Here, hue = (i*255/k) will range from 0 to 255(max).
leds[i] = CHSV((i*255/k)-j, SATURATION, BRIGHTNESS); //This will make a static and even distribution of hue throughout the strip
FastLED.show(); //The 'j' value changes and the static hue starts moving
delay(25);} // The speed of the wave can be adjusting appropriate value of delay in milliseconds
}