13#define FRAMES_PER_SECOND 60
15bool gReverseDirection =
false;
86 Fire2012WithPalette();
132void Fire2012WithPalette()
135 static uint8_t heat[NUM_LEDS];
138 for(
int i = 0; i < NUM_LEDS; i++) {
139 heat[i] =
qsub8( heat[i],
random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
143 for(
int k= NUM_LEDS - 1; k >= 2; k--) {
144 heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
154 for(
int j = 0; j < NUM_LEDS; j++) {
157 uint8_t colorindex =
scale8( heat[j], 240);
160 if( gReverseDirection ) {
161 pixelnumber = (NUM_LEDS-1) - j;
165 leds[pixelnumber] = color;
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void delay(unsigned long ms)
Delay for the given number of milliseconds.
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
RGB color palette with 16 discrete values.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Get a color from a palette.
const TProgmemRGBPalette16 HeatColors_p
Approximate "black body radiation" palette, akin to the FastLED HeatColor() function.
LIB8STATIC void random16_add_entropy(uint16_t entropy)
Add entropy into the random number generator.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Representation of an RGB pixel (Red, Green, Blue)