# Trying to re-learn what I learned 2 years ago but my time is short

(Josh Dulcich) #1

Trying to re-learn what I learned 2 years ago but my time is short and I need this project done today.
I need simple fastled code that will color cycle a strip of leds through the rainbow. All 20 leds at the same time. They are ws2811 pixels. Anyone got a second. I looked through the examples library but it’s taking me too long to figure this out. I know it’s simple. Thanks and merry christmas to anyone that can help. This is to decorate a 2 ft tree for my restaurant christmas party tonight!

(Josh Dulcich) #2

wow seems overly complicated. need something simple and I thought fastled could do it.

color=a
set.stripcolor=a
if a=< 255+1
if a=255 a=0

(Josh Dulcich) #3

is that neopixel or fastled?

(Josh Dulcich) #4

this almost works. but it is only changing the first pixel and it is missing the command to +1 the color until it gets to 255

#include <FastLED.h>
#define NUM_LEDS 20
#define DATA_PIN 0
CRGB leds[NUM_LEDS];

``````void setup() {
``````

}

void loop() {
leds[0] = CRGB::Red;
FastLED.show();
delay(30);
}

(Josh Dulcich) #5

almost got it. this is changing my whole array from red to green to blue. just need the parts to make it hsv color cycle i think.

#include “FastLED.h”
#define NUM_LEDS 20
#define DATA_PIN 0
CRGB leds[NUM_LEDS];

void setup() {

``````  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
``````

}

void loop() {

`````` fill_solid(leds, NUM_LEDS, CRGB::Red); // Set all to red.
FastLED.show();
delay(2000);
fill_solid(leds, NUM_LEDS, CRGB::Green); // Set all to red.
FastLED.show();
delay(2000);
fill_solid(leds, NUM_LEDS, CRGB::Blue); // Set all to red.
FastLED.show();
delay(2000);
``````

}

(Josh Dulcich) #6

BOOM!
figured it out!
thanks to anyone and everyone who helped. Here is the code I mashed together to make a strip color cycle on fastled.

#include <FastLED.h>
#define NUM_LEDS 20
#define DATA_PIN 0
CRGB leds[NUM_LEDS];

``````void setup() {