#include "FastLED.h"
// Matrix size
#define NUM_ROWS 37
#define NUM_COLS 17
#define NUM_LEDS NUM_ROWS * NUM_COLS
// LEDs pin
#define DATA_PIN 3
// #define LED_TYPE WS2812B
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
// LED brightness
#define BRIGHTNESS 255
#define MAX_POWER_MILLIAMPS 2000
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
// FastLED.setMaxPowerInVoltsAndMilliamps(5, MAX_POWER_MILLIAMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
}
const int XYtable [] PROGMEM = {
36, 37, 110, 111, 184, 185, 258, 259, 332, 333, 406, 407, 480, 481, 554, 555, 628,
35, 38, 109, 112, 183, 186, 257, 260, 331, 334, 405, 408, 479, 482, 553, 556, 627,
34, 39, 108, 113, 182, 187, 256, 261, 330, 335, 404, 409, 478, 483, 552, 557, 626,
33, 40, 107, 114, 181, 188, 255, 262, 329, 336, 403, 410, 477, 484, 551, 558, 625,
32, 41, 106, 115, 180, 189, 254, 263, 328, 337, 402, 411, 476, 485, 550, 559, 624,
31, 42, 105, 116, 179, 190, 253, 264, 327, 338, 401, 412, 475, 486, 549, 560, 623,
30, 43, 104, 117, 178, 191, 252, 265, 326, 339, 400, 413, 474, 487, 548, 561, 622,
29, 44, 103, 118, 177, 192, 251, 266, 325, 340, 399, 414, 473, 488, 547, 562, 621,
28, 45, 102, 119, 176, 193, 250, 267, 324, 341, 398, 415, 472, 489, 546, 563, 620,
27, 46, 101, 120, 175, 194, 249, 268, 323, 342, 397, 416, 471, 490, 545, 564, 619,
26, 47, 100, 121, 174, 195, 248, 269, 322, 343, 396, 417, 470, 491, 544, 565, 618,
25, 48, 99, 122, 173, 196, 247, 270, 321, 344, 395, 418, 469, 492, 543, 566, 617,
24, 49, 98, 123, 172, 197, 246, 271, 320, 345, 394, 419, 468, 493, 542, 567, 616,
23, 50, 97, 124, 171, 198, 245, 272, 319, 346, 393, 420, 467, 494, 541, 568, 615,
22, 51, 96, 125, 170, 199, 244, 273, 318, 347, 392, 421, 466, 495, 540, 569, 614,
21, 52, 95, 126, 169, 200, 243, 274, 317, 348, 391, 422, 465, 496, 539, 570, 613,
20, 53, 94, 127, 168, 201, 242, 275, 316, 349, 390, 423, 464, 497, 538, 571, 612,
19, 54, 93, 128, 167, 202, 241, 276, 315, 350, 389, 424, 463, 498, 537, 572, 611,
18, 55, 92, 129, 166, 203, 240, 277, 314, 351, 388, 425, 462, 499, 536, 573, 610,
17, 56, 91, 130, 165, 204, 239, 278, 313, 352, 387, 426, 461, 500, 535, 574, 609,
16, 57, 90, 131, 164, 205, 238, 279, 312, 353, 386, 427, 460, 501, 534, 575, 608,
15, 58, 89, 132, 163, 206, 237, 280, 311, 354, 385, 428, 459, 502, 533, 576, 607,
14, 59, 88, 133, 162, 207, 236, 281, 310, 355, 384, 429, 458, 503, 532, 577, 606,
13, 60, 87, 134, 161, 208, 235, 282, 309, 356, 383, 430, 457, 504, 531, 578, 605,
12, 61, 86, 135, 160, 209, 234, 283, 308, 357, 382, 431, 456, 505, 530, 579, 604,
11, 62, 85, 136, 159, 210, 233, 284, 307, 358, 381, 432, 455, 506, 529, 580, 603,
10, 63, 84, 137, 158, 211, 232, 285, 306, 359, 380, 433, 454, 507, 528, 581, 602,
9, 64, 83, 138, 157, 212, 231, 286, 305, 360, 379, 434, 453, 508, 527, 582, 601,
8, 65, 82, 139, 156, 213, 230, 287, 304, 361, 378, 435, 452, 509, 526, 583, 600,
7, 66, 81, 140, 155, 214, 229, 288, 303, 362, 377, 436, 451, 510, 525, 584, 599,
6, 67, 80, 141, 154, 215, 228, 289, 302, 363, 376, 437, 450, 511, 524, 585, 598,
5, 68, 79, 142, 153, 216, 227, 290, 301, 364, 375, 438, 449, 512, 523, 586, 597,
4, 69, 78, 143, 152, 217, 226, 291, 300, 365, 374, 439, 448, 513, 522, 587, 596,
3, 70, 77, 144, 151, 218, 225, 292, 299, 366, 373, 440, 447, 514, 521, 588, 595,
2, 71, 76, 145, 150, 219, 224, 293, 298, 367, 372, 441, 446, 515, 520, 589, 594,
1, 72, 75, 146, 149, 220, 223, 294, 297, 368, 371, 442, 445, 516, 519, 590, 593,
0, 73, 74, 147, 148, 221, 222, 295, 296, 369, 370, 443, 444, 517, 518, 591, 592
};
void loop() {
fire2021();
FastLED.show();
}
void fire2021 (){
int a = millis();
int a1 = a/2;
uint16_t yScale = a;
int index = 0;
for (byte j = 0; j < NUM_ROWS; j++) {
uint16_t xScale = 0;
byte yHeight = abs8(j - (NUM_ROWS-1)) * 255 / (NUM_ROWS+8); //высота огня тут - (NUM_ROWS+10)
for (byte i = 0; i < NUM_COLS; i++) {
int ledsindex= pgm_read_word (XYtable+index);
byte val = qsub8 (inoise8 (xScale, yScale, a1), yHeight);
CRGB color = HeatColor(val);
leds[ledsindex] = color;
xScale +=40;
index++;
}
yScale += 40;
}
}
FPS: 0
Power: 0.00W
Power: 0.00W