-
-
Save StefanPetrick/45f7178829e206508c2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FastLED.h" | |
#define NUM_LEDS 288 | |
CRGB leds[NUM_LEDS]; | |
static uint32_t x_1; | |
static uint32_t y_1; | |
static uint32_t z_1; | |
uint8_t noise[NUM_LEDS]; | |
void setup() { | |
FastLED.addLeds<APA102, 7, 14, BGR, DATA_RATE_MHZ(24)>(leds, NUM_LEDS); | |
} | |
void loop() { | |
pattern2(); | |
} | |
void pattern2() { | |
//fill noise | |
x_1 += 200; | |
y_1 += 300; | |
for (int i = 0; i < NUM_LEDS; i++) { | |
uint8_t data = inoise16(x_1 , y_1 + (i * 4000), z_1) >> 8; | |
noise[i] = data; | |
} | |
// map noise | |
for (int i = 0; i < NUM_LEDS; i++) { | |
uint8_t index = (noise[i] / 2) - 64; | |
uint8_t bri = noise[i]; | |
CRGB color = CHSV( index, 255, bri); | |
leds[i] = color; | |
} | |
LEDS.show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment