ldirko / Splendida-Fibonacci-256-demoreel

7 stars 2 forks source link

add fibonacci stripe layout #8

Open ldirko opened 3 years ago

ldirko commented 3 years ago

fibonacci_strip_layout

for any skethes that work with Splendida as single led strip but map leds fith fibonacci distr.

ldirko commented 3 years ago

looks like its work now:

`// test fibonaccy strip layout

include "FastLED.h"

// Matrix size

define NUM_LEDS_FIB_STRIP 256

// LEDs pin

define DATA_PIN 3

// LED brightness

define BRIGHTNESS 255

// Define the array of leds CRGB leds[257];

static const uint16_t Fibon_Strip[] PROGMEM ={ 0, 98, 195, 49, 146, 243, 74, 171, 24, 122, 219, 50, 147, 244, 97, 194, 25, 123, 220, 73, 170, 1, 99, 196, 48, 145, 242, 75, 172, 23, 121, 218, 51, 148, 245, 96, 193, 26, 124, 221, 72, 169, 2, 100, 197, 47, 144, 241, 76, 173, 22, 120, 217, 52, 149, 246, 95, 192, 27, 125, 222, 71, 168, 3, 101, 198, 46, 143, 240, 77, 174, 21, 119, 216, 53, 150, 247, 94, 191, 28, 126, 223, 70, 167, 4, 102, 199, 45, 142, 239, 78, 175, 20, 118, 215, 54, 151, 248, 93, 190, 29, 127, 224, 69, 166, 5, 103, 200, 44, 141, 238, 79, 176, 19, 117, 214, 55, 152, 249, 92, 189, 30, 128, 225, 68, 165, 6, 104, 201, 43, 140, 237, 80, 177, 18, 116, 213, 56, 153, 250, 91, 188, 31, 129, 226, 67, 164, 7, 105, 202, 42, 139, 236, 81, 178, 17, 115, 212, 57, 154, 251, 90, 187, 32, 130, 227, 66, 163, 8, 106, 203, 41, 138, 235, 82, 179, 16, 114, 211, 58, 155, 252, 89, 186, 33, 131, 228, 65, 162, 9, 107, 204, 40, 137, 234, 83, 180, 15, 113, 210, 59, 156, 253, 88, 185, 34, 132, 229, 64, 161, 10, 108, 205, 39, 136, 233, 84, 181, 14, 112, 209, 60, 157, 254, 87, 184, 35, 133, 230, 63, 160, 11, 109, 206, 38, 135, 232, 85, 182, 13, 111, 208, 61, 158, 255, 86, 183, 36, 134, 231, 62, 159, 12, 110, 207, 37 };

void setup() { FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, 256); FastLED.setBrightness(BRIGHTNESS); }

// void loop() { // static byte speed=0; // const float hl = NUM_LEDS_FIB_STRIP/8;
// EVERY_N_MILLISECONDS(50) { speed++; }

// int t = millis()/4;

// for (int i = 0; i <NUM_LEDS_FIB_STRIP; i++) { // int index = pgm_read_byte(Fibon_Strip+(i+speed)%255);

// int c = (abs(i - hl)/hl)24; // byte b = sin8(c+t/8+i/2); // leds [index].setRGB (sin8(b+i8+t), sin8(b+leds [index].b/4+t/2), sin8(b+t)); // } // LEDS.show(); // }

// void loop(){

// uint16_t a= millis()/4; // static byte speed; // for (int j = 0; j <NUM_LEDS_FIB_STRIP; j++) {

// int index = pgm_read_byte(Fibon_Strip+(j+speed)%255); // leds[index] = HeatColor( inoise8 (0, j * 5 , a+j ));

// }

// LEDS.show(); // speed=sin8(speed/8+a/8); // }

void loop(){ static byte speed; EVERY_N_MILLISECONDS(50) { speed++; } uint16_t a= millis()/8;

for (int j = 0; j <NUM_LEDS_FIB_STRIP; j++) { int index = pgm_read_byte(Fibon_Strip+(j+speed)%255); leds[index].setRGB(inoise8 (j 20-a), sin8(j-a/2), sin8(j2+a/3)); } LEDS.show(); }

`