Hi everyone,
I received a WS2812B strip a few hours ago. I am using it with my Arduino Uno. So far, I have managed to make a rainbow effect by changing the hue of a CHSV code by 10 for each LED on the strip. However, I am trying to create an effect with the LEDs so the rainbow moves along the strip, but it is currently static. I am using the FastLED library.
Here is my code for the rainbow effect:
#include <FastLED.h>
#define LED_PIN 5
#define NUM_LEDS 150
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define BRIGHTNESS 64
int Hue = 0;
int dot = 0;
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
// put your main code here, to run repeatedly:
for(int dot = 0;dot < NUM_LEDS; dot++){
for(int Hue = 0;Hue <255; dot++){
Hue = Hue + 10;
if (Hue == 0){
Hue = 10;
}
leds[dot] = CHSV(Hue, 255, 255);
FastLED.show();
}
delay(100);
}
}
I was wondering is there is a way that I can adapt this code to make the rainbow move along the strip?
Thank you!!
(P.S. This is my first post - sorry if I posted in the wrong place!)