Hi all, I'm using FastLED with NeoPixel try wo write my first code.

Hi all,

I’m using FastLED with NeoPixel try wo write my first code. I wonder if it is possible to save a color into a variable and use it in every subroutine. At the moment I use CRGB::White in several line but I want to make it changeable only in the beginning of my code. Any help is appreciated.

I also want to change the brighness of single pixels in my stripe without using the dimming / fading functions. Unfortunately I’m only able to set the brightness for the complete stripe or uns e.g. fadebylight for single pixels.

To save and use a variable, just use CRGB c = CRGB::color. YOu can make that variable global just like your leds[] array.

If you want to act on a single pixel, you can use CHSV and change the s value of the CHSV structure, or you can do math on individual pixels and dim them yourself.

@Peter_Buelow Hi Peter, Thank you very much for coming back to my question. I’m still confused about using CHSV to set the pixel brightness. I use it like this:

CRGBArray<NUM_LEDS> leds;
CRGBSet pixel1(leds(0,1));
CRGB color(255,255,255);

fill_solid(pixel1, 1, CRGB(CHSV(0,0,100)));

but when I change the pixelcolor e.g. to color(255,0,0);

the color is still White instead of red with the brightness of 100. At which point do I fail?

@Stephan_DG1BGS see this https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors on how HSV works. Also, you don’t need to convert HSV to RGB for it to work - try without it.

@Stephan_DG1BGS ​ Here’s some examples which have colors defined or setup as variables.

A saturation of 0 will always be white. Try higher values - say between 128-255.

Thanks all for all your great help. In the meanwhile I understood how to use HSV colors. Everything works like a charm now.