analog output gradient between 2 colors Hi there and good Morning to everyone here.

fastled-support
gplus
(Jörg G) #1

analog output gradient between 2 colors

Hi there and good Morning to everyone here.
I´m having a little problem of understanding. And it is not so easy finding tutorials in an good understndable kind.

The problem is to create an gradient between two colors with an analog output. I use the analog output and it wors fine for perhaps two colors. That is not the problem. Just to make it work withe the keywords. So I found the fill gradient rgb. But I don´t know do define startcolor and endcolor or startpos and endpos. It cound´t be much to change. It would be vey nice if someone can help me.

Here i what I´m need it for.

Thanks a lot vor your help. :wink:

(Stefan Petrick) #2

Looks good. What material is it? Overheated plexi? Didi you already read the comments about fill_gradient in https://github.com/FastLED/FastLED/blob/master/colorutils.h ?

(Jörg G) #3

Guten Morgen Stefan!
Ja. Es ist Kunststoff. :wink:
ICh guck mir den Link jetzt mal an. Danke schonmal dafür. Viele Grüße aus der Domstadt

Jörg

(Jörg G) #4

Das ist die Datei wo ich meine Informationen her habe. Nur weiß ich leider nicht wie ich die startfarbe definieren kann und ob ich eine startpos definieren muß … da hängt es bei mir -weißt Du wie das geht?

(Stefan Petrick) #5

Have a look here for an explained example: http://buildinganledsuit.blogspot.de/p/fastled-fill-gradient-function.html The first number in the CHSV brackets defines the color. And here you have the CHSV rainbow color chart: https://raw.githubusercontent.com/FastLED/FastLED/gh-pages/images/HSV-rainbow-with-desc.jpg Does that answer your question?

(Jörg G) #6

Thanks a lot. I will spend some time to study. :wink:
later I will let you know how it works or for further questions :wink:

(Mark Kriegsman) #7

fill_gradient fills a range of multiple LEDs all at once. It does not change over time.

I think you that if you want to change the color of just ONE output over time, fill_gradient is not the right tool.

Instead you want to use the blend pixel function. In general it works like:

CRGB c1( CRGB::Green );
CRGB c2( CRGB::Blue );
uint8_t amountOfBlend;

… {set amountOfBlend to something 0…255 } …

CRGB mix = blend( c1, c2, amountOfBlend);

The you display the “mix” color.

If you want to slowly shift back and forth between the two colors, try this way of setting amountOfBlend:

amountOfBlend = beatsin8( 4 ); //four/minute

This help?

(Stefan Petrick) #8

Just an idea how to make fill_gradient change over time (untested):

fill_gradient( leds, 0, CHSV( millis() / 1000, 255 , 255), NUM_LEDS, CHSV( millis() / 500, 255, 255), SHORTEST_HUES);

The beginning color should change one step every second, the end color every half second. If that’s to slow the divisors need to go down.

(Mark Kriegsman) #9

@Stefan_Petrick : you can also just use beat8( bpm ) if all you want is the repeating ramp up 0…255 over and over. (Note: different from beatsin8.)

(Stefan Petrick) #10

Thanks for the reminder Mark, I need to get rid of my old habits…

(Mark Kriegsman) #11

We all can keep learning!
(Eg see Dan’s awesome new range loop syntax!)

(Jörg G) #12

Thank you thank you thank you
I wil try it out and lief reply later :wink:
Thank you :wink:

(Michael Weber) #13

Would you mind telling us how to create such an object?
Maybe with some pictures?