Skip to content

Instantly share code, notes, and snippets.

@StefanPetrick
Last active March 7, 2016 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanPetrick/45f7178829e206508c2a to your computer and use it in GitHub Desktop.
Save StefanPetrick/45f7178829e206508c2a to your computer and use it in GitHub Desktop.
#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