#define LED_PIN 5
#define COLOR_ORDER GRB
#define CHIPSET WS2811
#define NUM_LEDS 30
#define BRIGHTNESS 200
#define FRAMES_PER_SECOND 60
bool gReverseDirection = false;
void setup() {
delay(3000);
}
void loop()
{
Fire2012WithPalette();
}
#define COOLING 55
#define SPARKING 120
void Fire2012WithPalette()
{
static uint8_t heat[NUM_LEDS];
for( int i = 0; i < NUM_LEDS; i++) {
heat[i] =
qsub8( heat[i],
random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
}
for( int k= NUM_LEDS - 1; k >= 2; k--) {
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
}
}
for( int j = 0; j < NUM_LEDS; j++) {
uint8_t colorindex =
scale8( heat[j], 240);
int pixelnumber;
if( gReverseDirection ) {
pixelnumber = (NUM_LEDS-1) - j;
} else {
pixelnumber = j;
}
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)