//Менять 126 вместо 255 //Perlin noise fire procedure
//reddit.com/r/FastLED/comments/hgu16i/my_fire_effect_implementation_based_on_perlin
//idea ti make perlin noise with time offset X and Z coord
//this automatic scroll fire pattern and distort fire noise.
//then substract Y based coord value to shift fire color (not brightness) in palette.
//fadeout color from bottom matrix to up.
//need some palette tweak for good looking fire color
#include "FastLED.h"
#define NUM_ROWS 16
#define NUM_COLS 16
#define NUM_LEDS NUM_ROWS * NUM_COLS
#define DATA_PIN 3
#define BRIGHTNESS 255
CRGB leds[NUM_LEDS]; // array of leds
DEFINE_GRADIENT_PALETTE(firepal) {// fire palette, firepal - что за тип?
0, 0, 0, 0, //black
32, 255, 0, 0, // red
190, 255, 255, 0, //yellow
255, 255, 255, 255 // white
};
CRGBPalette16 myPal = firepal;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() { //Огонь abs8(), qsub8 () 8-bit
int a = millis();
for(int i=0; i < NUM_COLS; i++) {
for(int j=0; j < NUM_ROWS; j++) { //960 max
leds[XY(i,j)]=ColorFromPalette(myPal, qsub8(inoise8(i*60,j*60+a,a/3),
abs8(j-(NUM_ROWS-1))*255/(NUM_ROWS-1)),BRIGHTNESS);
}
}
FastLED.delay(5); // что это?
}
uint8_t XY(uint8_t x, uint8_t y) { return (y * NUM_COLS + x);}
//or generate XY function for your matrix there:
//https://macetech.github.io/FastLED-XY-Map-Generator/