#include "FastLED.h"
// Matrix size
#define NUM_ROWS 8
#define NUM_COLS 8
#define NUM_COLS_CILINDR 28
#define NUM_ROWS_CILINDR 7
// LEDs pin
#define DATA_PIN 3
// LED brightness
#define BRIGHTNESS 255
#define NUM_LEDS NUM_ROWS * NUM_COLS
// Define the array of leds
CRGB leds[NUM_LEDS+1]; //one safe pixel (index=64)
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
uint16_t a= millis()/8;
for (byte i=0; i< NUM_COLS_CILINDR; i++){
for (byte j=0; j< NUM_ROWS_CILINDR; j++){
byte ledsindex = XY_8_8_Cilindr (i,j);
if (ledsindex!=64) leds[ledsindex].setHue (i*16+(sin8((j<<3)+a))>>1);
// if (ledsindex!=64) leds[ledsindex].setHue (i*255/(NUM_COLS_CILINDR-1)+a/2); //full moving rainbow
// if (ledsindex!=64) leds[ledsindex].setHue ((i*16+j*16)/2+a/2); //diagonal pattern
// if (ledsindex!=64) leds[ledsindex]= HeatColor(inoise8(i*40-a*2,j*40+a*2)); //red tonnel
}
LEDS.show();
}
} //loop
byte XY_8_8_Cilindr (byte x, byte y) {
byte XY_88_tableCil [] = {
64, 64, 64, 7, 64, 64, 64, 64, 64, 64, 0, 64, 64, 64, 64, 64, 64, 56, 64, 64, 64, 64, 64, 64, 63, 64, 64, 64,
64, 64, 15, 64, 6, 64, 64, 64, 64, 1, 64, 8, 64, 64, 64, 64, 48, 64, 57, 64, 64, 64, 64, 62, 64, 55, 64, 64,
31, 23, 64, 14, 64, 5, 4, 3, 2, 64, 9, 64, 16, 24, 32, 40, 64, 49, 64, 58, 59, 60, 61, 64, 54, 64, 47, 39,
30, 64, 22, 64, 13, 64, 12, 11, 64, 10, 64, 17, 64, 25, 33, 64, 41, 64, 50, 64, 51, 52, 64, 53, 64, 46, 64, 38,
64, 64, 64, 21, 64, 64, 64, 64, 64, 64, 18, 64, 64, 64, 64, 64, 64, 42, 64, 64, 64, 64, 64, 64, 45, 64, 64, 64,
64, 29, 64, 64, 64, 20, 64, 64, 19, 64, 64, 64, 26, 64, 64, 34, 64, 64, 64, 43, 64, 64, 44, 64, 64, 64, 37, 64,
64, 64, 64, 28, 64, 64, 64, 64, 64, 64, 27, 64, 64, 64, 64, 64, 64, 35, 64, 64, 64, 64, 64, 64, 36, 64, 64, 64};
byte index = XY_88_tableCil [y*NUM_COLS_CILINDR + x];
return (index);
}