I need some help because I can not seem tofigure this out on my

fastled-samples
gplus
(Jack Keeney) #1

I need some help because I can not seem tofigure this out on my own.
I want to have a smooth gradient(?) change from Aqua to Orange…Aqua on the ends of the strip and Orange in the middle and then slowly swap the two colors back and forth. I have tried so many times I am frustrated and humbly ask for someone to write this code so I can see how it works. AND if I am lucky enough to get someone to help, could document the code as much as possible.I am a beginner at coding. Thank you ALL.

(Mark Kriegsman) #2

What have you tried and how does it come out?

Eg, can you make it look right statically before the swap animation?

Also: just curious what you think here, and there are many “correct” answers, but: what do you think should be shown half way between the orange at one end and the aqua at the other? What should the middle pixel look like? (And again: never mind the animation part; we’re just talking static color gradient.) Likely possible answers include: white, black, gray, green (green is half way hue-wise between orange and aqua), and there are other equally valid answers. The one that you choose helps figure out what you want it to look like, and how to get there.

(Jack Keeney) #3

Well, I would like to have just the two colors (Aqua, Orange), but if another color must be in there, I think Black might be nice…As far as getting it to work at all…nope. The only thing I have been able to figure out how to do is just fill the strip with a single color OR a rainbow using code like this.
for (int x = 0; x < NUMLED; x++) {
fill_rainbow( leds, NUMLED, 0, 5);
FastLED.show();
//-------------------------------------------------------
for (int x = 0; x < NUMLED; x++) {
leds[x] = CRGB::Black;
FastLED.show();

I do not understand what blending is and am fuzzy on the gradient concept. (Does gradient mean smooth transition from ANY two colors or btween a range of colors determined by color wheel?) Other than the code above, I have no knowledge on how to use this library…THANK YOU VERY MUCH for your kind help and quick response!!! I REALLY appriciate it!

(Andrew Tuline) #4

Here’s one possibility:

(Jack Keeney) #5

Thank you Andrew…Could help me with a question?
In this line…
uint8_t speed = beatsin8(6,0,255);

What is the “beatsin8” ? I have never seen this command(?) before. What is it doing? My guess it is for sine-wave type thing(?)

(Andrew Tuline) #6

It’s a FastLED function that returns a value between 0 and 255 over time. It’s really a sine wave, and in this case, it’s 6 complete sine waves in a minute. It’s a much nicer way to animate your code instead of using nasty old ‘for’ loops or (heaven forbid) delay statements.

(Jack Keeney) #7

THANK YOU VERY VERY MUCH SIR!!! This is a big help for me. :slight_smile:

(Jack Keeney) #8

Where can I find more commands AND docs for them for FastLED? Thanks again!

(Andrew Tuline) #9


http://fastled.io/docs/3.1/modules.html

Oh, and another way to do this would be to define a couple of palettes and then use nblendPaletteTowardPalette(), such as: