Hey guys wondering if someone can help me with some code.

Hey guys wondering if someone can help me with some code. I want to mirror the Fire 2012 effect on an LED strip thats 56 LEDs long. Like i want it to start from 1 to 28 and from 56 to 29. I know there an example for 2 patterns at the same time but im not sure how to make the flame from from 56->29 as opposed to 29->56

This version creates two different fire animations from the centre to the ends.

Change the second variable in the addmod8 statements on the last two lines to set the centre of the fire…

It should give you something to work from.

void Fire2012WithPalette()
{
// Array of temperature readings at each simulation cell
static byte heat[NUM_LEDS / 2];
static byte heat1[NUM_LEDS / 2];
// Step 1. Cool down every cell a little
for ( int i = 0; i < (NUM_LEDS / 2); i++) {
heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / (NUM_LEDS / 2)) + 2));
heat1[i] = qsub8( heat1[i], random8(0, ((COOLING * 10) / (NUM_LEDS / 2)) + 2));
}

// Step 2. Heat from each cell drifts ‘up’ and diffuses a little
for ( int k = (NUM_LEDS / 2); k >= 2; k–) {
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
heat1[k] = (heat1[k - 1] + heat1[k - 2] + heat1[k - 2] ) / 3;
}

// Step 3. Randomly ignite new ‘sparks’ of heat near the bottom
if ( random8() < SPARKING ) {
int y = random8(7);
heat[y] = qadd8( heat[y], random8(160, 255) );
int z = random8(7);
heat1[z] = qadd8( heat[z], random8(160, 255) );
}

// Step 4. Map from heat cells to LED colors
for ( int j = 0; j < (NUM_LEDS / 2); j++) {
// Scale the heat value from 0-255 down to 0-240
// for best results with color palettes.
byte colorindex = scale8( heat[j], 240);
byte colorindex1 = scale8( heat1[j], 240);
CRGB color = ColorFromPalette( HeatColors_p, colorindex);
CRGB color1 = ColorFromPalette( HeatColors_p, colorindex1);
uint8_t pixelnumber;
LedsLeft[addmod8(j, (NUM_LEDS / 2), NUM_LEDS)] = color;
LedsLeft[addmod8(NUM_LEDS - j, (NUM_LEDS / 2) - 1, NUM_LEDS)] = color1;
}
}

Wouldn’t it be the same as running it on a 2x28 matrix?

Also, if you want the two strips to mirror each other, you can just connect their signal wires to the same output pin.

@Cristian_Martinez Here’s how I did it, mirroring to second half of strip.

@Jeremy_Spencer ​ thanx man. And i actually want them going from the tips to the center :slight_smile:

@allanGEE ​ im using an Attiny85 so matrix is out of the question lol

@marmil ​ thanx man :slight_smile:

You can reverse the direction if needed by flipping the boolean on line 25 thanks to the awesomenss factor of Mr. Kriegsman.

Thanx for pointing that out lol. Will try it out when i get home