#include <FastLED.h>
#define NUM_LEDS 18
#define LED_PIN 2
CRGB leds[NUM_LEDS];
uint8_t paletteIndex = 0;
DEFINE_GRADIENT_PALETTE( FirePalette ) {
0, 0, 0, 0, //black
128, 255, 0, 0, //red
200, 255, 255, 0, //bright yellow
255, 255, 255, 255 //full white
};
CRGBPalette16 myPal = FirePalette;
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(250);
}
void loop() {
EVERY_N_MILLISECONDS(30){
//Switch on an LED at random, choosing a random color from the palette
leds[random8(0, NUM_LEDS - 1)] = ColorFromPalette(myPal, random8(), 255, LINEARBLEND);
}
// Fade all LEDs down by 1 in brightness each time this is called
fadeToBlackBy(leds, NUM_LEDS, 1);
FastLED.show();
}