//241 LED ring Perlin Fire
//Fastled rgb led demo
//Yaroslaw Turbin, 22.01.2021
//https://vk.com/ldirko
//https://www.reddit.com/user/ldirko/
// thx thx sutaburosu for leds circuit anв wokwi for awesome emulator
#include <FastLED.h>
#define LED_PIN 3
#define NUM_COLS 17
#define NUM_ROWS 17
#define NUM_LEDS NUM_COLS*NUM_ROWS
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS+1];
void setup() {FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);}
void loop() {
int a = millis();
for (int j = 0; j < NUM_ROWS; j++) {
for (int i = 0; i < NUM_COLS; i++) {
leds[XY1(i,j)] = HeatColor(qsub8 (inoise8 (i * 60 , j * 60+ a , a /3),
abs8(j - (NUM_ROWS-1)) * 255 / (NUM_ROWS+3)));
// leds[XY1(i,j)] = CHSV (sin8(i*8+sin8(i*2+a/9))/2+sin8(j*8+sin8(j*8+a/8)/2),255,255);
}}
FastLED.show();
}
byte XY1 (byte x, byte y) {
static byte PlanarLookTable [] = { //i made this lookup table in Excel ))))
241, 53, 54, 55, 56, 57, 58, 59, 0, 1, 2, 3, 4, 5, 6, 7, 241,
52, 241, 241, 103, 104, 105, 106, 107, 60, 61, 62, 63, 64, 65, 241, 241, 8,
51, 241, 102, 241, 144, 145, 146, 147, 108, 109, 110, 111, 112, 241, 66, 241, 9,
50, 101, 241, 143, 241, 177, 178, 179, 148, 149, 150, 151, 241, 113, 241, 67, 10,
49, 100, 142, 241, 176, 241, 202, 203, 180, 181, 182, 241, 152, 241, 114, 68, 11,
48, 99, 141, 175, 241, 201, 241, 219, 204, 205, 241, 183, 241, 153, 115, 69, 12,
47, 98, 140, 174, 200, 241, 218, 231, 220, 221, 206, 241, 184, 154, 116, 70, 13,
46, 97, 139, 173, 199, 217, 230, 239, 232, 233, 222, 207, 185, 155, 117, 71, 14,
45, 96, 138, 172, 198, 216, 229, 238, 241, 234, 223, 208, 186, 156, 118, 72, 15,
44, 95, 137, 171, 197, 215, 228, 237, 236, 235, 224, 209, 187, 157, 119, 73, 16,
43, 94, 136, 170, 196, 241, 214, 227, 226, 225, 210, 241, 188, 158, 120, 74, 17,
42, 93, 135, 169, 241, 195, 241, 213, 212, 211, 241, 189, 241, 159, 121, 75, 18,
41, 92, 134, 241, 168, 241, 194, 193, 192, 191, 190, 241, 160, 241, 122, 76, 19,
40, 91, 241, 133, 241, 167, 166, 165, 164, 163, 162, 161, 241, 123, 241, 77, 20,
39, 241, 90, 241, 132, 131, 130, 129, 128, 127, 126, 125, 124, 241, 78, 241, 21,
38, 241, 241, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 241, 241, 22,
241, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 241};
return (PlanarLookTable[y*NUM_COLS+x]);
}