# anyone can help me,

(Sheena Variasi) #1

anyone can help me, i am to trying rainbow effect from outside to center but i cant solved this problem.

void loop() {
for(int j = 0; j < 256; j++) {
for(int i = 0; i < (NUM_LEDS / 2)+1; i++) {
leds[i] = Scroll((i * 256 / NUM_LEDS + j) % 256);
leds[NUM_LEDS] = Scroll((-i * 256 / NUM_LEDS + j) % 256);
}

``````	FastLED.show();
delay(1);
}
``````

}

// WS2812B LED Strip switches Red and Green
CRGB Scroll(int pos) {
CRGB color (0,0,0);
if(pos < 85) {
color.g = 0;
color.r = ((float)pos / 85.0f) * 255.0f;
color.b = 255 - color.r;
} else if(pos < 170) {
color.g = ((float)(pos - 85) / 85.0f) * 255.0f;
color.r = 255 - color.g;
color.b = 0;
} else if(pos < 256) {
color.b = ((float)(pos - 170) / 85.0f) * 255.0f;
color.g = 255 - color.b;
color.r = 1;
}
return color;
}

(Andrew Tuline) #2

Regarding your color function; this looks like the NeoPixel color Wheel routine. Why not use FastLED’s CHSV, which is much simpler? I suggest that you spend time looking at (and modifying) existing FastLED demos that make use of functionality not available in the NeoPixel library.

Furthermore, FastLED includes a rainbow function, which makes life even easier. Have a look around and see what you can find.

(Sheena Variasi) #3

are you have the rainbow code with FastLED CHSV sir?

sorry, i am a newbie sir.
can you teach me?

(Andrew Tuline) #4

This one uses FastLED’s fill_rainbow function:

As for teaching, just search for some FastLED examples online and play around with them. There’s a LOT out there. In the meantime, if you get through these, you’ll be well on your way:

(Marc Miller) #5

(Patrick Aversenq) #6

Hi,
I think that you execute the 2nd block ´for’ before to update the leds by the Fastled.show and delay.

(Sheena Variasi) #7

@Andrew_Tuline thank you for reply sir…
G+ getting shut down, are you have messaging account? like whatsapp, etc?

(Sheena Variasi) #8

@marmil thank you mark, i am will to try this.

(Andrew Tuline) #9

@Sheena_Variasi There will most likely be an announcement by Mark and/or Dan at some pont as to where they’re moving the community to.