Have a heart - a somewhat confused user here.

Have a heart - a somewhat confused user here. I am using the FastLED library to create a realistic fake candle using a NeoPixel stick. Everything is working but I have a question - is there a way to ONLY change the brightness of a particular LED in the string? In other words, leave hue and saturation the same as is but just change the brightness?

i.e. something like this for a HSV value:

leds[i] = CHSV( keep the same, keep the same, new intensity);

I know I can set the color to Black to turn an LED off but I want to smoothly fade it out.

Thanks,
B

You want the nscale_video function. You give it a CRGB color and a value from 0-255 and it “dims” the color – the lower the value, the dimmer the result. It is a method on CRGB values. For example, this code takes a color and halves the brightness:

CRGB color = …some color…;
color.nscale8_video(128);

Also: the Fire2012 demo that is provided with the library does a pretty good job of emulating fire.

Simple answer = definitely yes !

I would just mention that the Hue , Saturation and Value in the CHSV should be unsigned 8 bit integer variables and you should have full control of them.

For a more detailed answer you should post your sketch on pastebin or github and explain what you can do already and what it is you actually struggle with !

Also, more info here:

Search for “dimming and brightening colors”

Have a look at the Fire2012 example - it may be delivering what you are trying to invent.

@Sam_Guyer Yes! The color.nscale8_video does want I needed. Thank you!

Fyi - I have tried the Fire2012 code and it just doesn’t look like what I am looking for. I am trying to simulate a candle flame and the Neopixel stick I am using only has 8 leds and I think the Fire2012 code will work better with more leds. As soon as I can figure out how to capture decent video I will post it. Using the camera on my phone makes the flame appear as a “blob” and it doesn’t do it justice.

Here is a video of the “candle” in action:
missing/deleted image from Google+

and you can download the code here:

Hey hey, that looks great Bruce!

Nice simulation indeed !

Fetched your code and will eventually dig into it but wondering if you have an easy way to reduce, soften, slow down the flame ?

Nice job @Bruce_N

I’ve got a bunch of those 8Led sticks I use for edge lighting - I’ll give your code a go. Thanks!