I want to create some effects for my led strip with my arduino nano as the controller.
So far I managed to get the basics done (same static color for each led, color fade with each leds simultaneous). I got a rainbow effect working, but its basically only a cycle through the color spectrum for all leds at the same time.
What I want is a rainbow wave, where the colors are moving in one direction and fading into/chasing each other.
I assume you want something like this:
I am using the FastLED library for this, but I think you can change the code a bit to make it work with different LED libraries.
#include <FastLED.h>
#define NUM_LEDS 60 /* The amount of pixels/leds you have */
#define DATA_PIN 7 /* The pin your data line is connected to */
#define LED_TYPE WS2812B /* I assume you have WS2812B leds, if not just change it to whatever you have */
#define BRIGHTNESS 255 /* Control the brightness of your leds */
#define SATURATION 255 /* Control the saturation of your leds */
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
for (int j = 0; j < 255; j++) {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(i - (j * 2), SATURATION, BRIGHTNESS); /* The higher the value 4 the less fade there is and vice versa */
}
FastLED.show();
delay(25); /* Change this to your hearts desire, the lower the value the faster your colors move (and vice versa) */
}
}