Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define BRIGHTNESS 200
- #define FRAMES_PER_SECOND 60
- #define SPARKING 255
- #define COOLING 85
- #define Z1_DATAPIN 1 //Declare Zone 1 data pin
- #define Z1_LEDS 50 //Declare Zone 1 number of LEDs
- CRGB Z1[Z1_LEDS]; //Declare Zone 1 FastLED data array
- byte Z1_Heat[Z1_LEDS]; //Delcare Zone 1 Heat map data array
- #define Z2_DATAPIN 2 //Declare Zone 2 data pin
- #define Z2_LEDS 61 //Declare Zone 2 number of LEDs
- CRGB Z2[Z2_LEDS]; //Declare Zone 2 FastLED data array
- byte Z2_Heat[Z2_LEDS]; //Delcare Zone 2 Heat map data array
- #define Z3_DATAPIN 3 //Declare Zone 3 data pin
- #define Z3_LEDS 52 //Declare Zone 3 number of LEDs
- CRGB Z3[Z3_LEDS]; //Declare Zone 3 FastLED data array
- byte Z3_Heat[Z3_LEDS]; //Delcare Zone 3 Heat map data array
- #define Z4_DATAPIN 4 //Declare Zone 4 data pin
- #define Z4_LEDS 44 //Declare Zone 4 number of LEDs
- CRGB Z4[Z4_LEDS]; //Declare Zone 4 FastLED data array
- byte Z4_Heat[Z4_LEDS]; //Delcare Zone 4 Heat map data array
- #define Z5_DATAPIN 5 //Declare Zone 5 data pin
- #define Z5_LEDS 41 //Declare Zone 5 number of LEDs
- CRGB Z5[Z5_LEDS]; //Declare Zone 5 FastLED data array
- byte Z5_Heat[Z5_LEDS]; //Delcare Zone 5 Heat map data array
- #define Z6_DATAPIN 6 //Declare Zone 6 data pin
- #define Z6_LEDS 40 //Declare Zone 6 number of LEDs
- CRGB Z6[Z6_LEDS]; //Declare Zone 6 FastLED data array
- byte Z6_Heat[Z6_LEDS]; //Delcare Zone 6 Heat map data array
- CRGBPalette16 gPal; //Set pallet array
- void setup()
- {
- delay(2000);
- FastLED.addLeds<WS2812B, Z1_DATAPIN, GRB>(Z1, 0, Z1_LEDS);
- FastLED.addLeds<WS2812B, Z2_DATAPIN, GRB>(Z2, 0, Z2_LEDS);
- FastLED.addLeds<WS2812B, Z3_DATAPIN, GRB>(Z3, 0, Z3_LEDS);
- FastLED.addLeds<WS2812B, Z4_DATAPIN, GRB>(Z4, 0, Z4_LEDS);
- FastLED.addLeds<WS2812B, Z5_DATAPIN, GRB>(Z5, 0, Z5_LEDS);
- FastLED.addLeds<WS2812B, Z6_DATAPIN, GRB>(Z6, 0, Z6_LEDS);
- FastLED.setBrightness(100);
- //gPal = HeatColors_p;
- // gPal = CRGBPalette16( CRGB::Black, CRGB::Red, CRGB::Yellow, CRGB::White);
- // gPal = CRGBPalette16( CRGB::Black, CRGB::Blue, CRGB::Aqua, CRGB::White);
- // gPal = CRGBPalette16( CRGB::Black, CRGB::Red, CRGB::White);
- gPal = CRGBPalette16( CRGB::Black, CRGB::Green, CRGB::YellowGreen, CRGB::White);
- }
- void loop() {
- random16_add_entropy( random());
- Fire2012(Z1_Heat, Z1, Z1_LEDS);
- Fire2012(Z2_Heat, Z2, Z2_LEDS);
- Fire2012(Z3_Heat, Z3, Z3_LEDS);
- Fire2012(Z4_Heat, Z4, Z4_LEDS);
- Fire2012(Z5_Heat, Z5, Z5_LEDS);
- Fire2012(Z6_Heat, Z6, Z6_LEDS);
- FastLED.show();
- FastLED.delay(1000 / FRAMES_PER_SECOND);
- }
- void Fire2012(byte *heat, CRGB *leds, int number_leds) //Might not need the "*" in front of the arrays...
- {
- for( int i = 0; i < number_leds; i++) {
- heat[i] = qsub8(heat[i], random8(0, ((COOLING * 10) / number_leds) + 2));
- }
- for( byte k= number_leds - 1; k >= 2; k--) {
- heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
- }
- if( random8() < SPARKING ) {
- int y = random8(7);
- heat[y] = qadd8( heat[y], random8(160,255) );
- }
- for( int j = 0; j < number_leds; j++) {
- //leds[j] = HeatColor(heat[j]);
- byte colorindex = scale8( heat[number_leds-j], 240);
- leds[j] = ColorFromPalette( gPal, colorindex);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement