A quick question about how the 'fire' travels from the bottom of the strips

(Aaron Bertrand) #1

A quick question about how the ‘fire’ travels from the bottom of the strips to the top. How would I change this orientation, the code that does this I’m assuming is:

    for( byte k= number_leds - 1; k >= 2; k--) {
            heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;

Any help would be appreciated.

Here is the code:


If anyone wants to take a gander. This is a copypasta of an earlier code that I added the number of zones I needed. Thanks and any criticism about how I am doing this would be appreciated. In the end I would like the top fixture part to be a solid pulsation with a random flash.

Edit: I would also like to make a playlist of animations tailored to the 6 led arrays. This light will be hanging above a chill area in our camp at Burning Man. So any bit of variation that would last about 5 minutes per animation would be awesome. Thanks for looking!

(Juergen Bruegl) #2

// Step 4. Map from heat cells to LED colors
for( int j = 0; j < number_leds; j++) {

// byte colorindex = scale8( heat[number_leds-j], 240); // this makes the thing upside down (!)

byte colorindex = scale8( heat[j], 240); // from bottom to top
leds[j] = ColorFromPalette( gPal, colorindex);

(Mark Kriegsman) #3

Since this turns out to be a popular request, I’ve added a “gReverseDirection” boolean to the Fire2012 and Fire2012WithPalette examples in the FastLED 3.1 branch on github. If you grab the latest version of the code from github, and set that boolean switch to “true”, the fire will turn ‘upside down.’

The internal ‘fire simulation’ is still burning ‘up’, but as each frame is translated from heat values to LED colors, it will either map through directly, or reversed. The code isn’t too hard to read, and it help illustrate the separation between the underlying ‘heat simulation’ and what’s rendered on the LEDs.

(matthi DELight) #4

thanx, i will use it for other effects.