12const uint8_t kMatrixWidth = 16;
13const uint8_t kMatrixHeight = 16;
15#define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight)
16#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
19const bool kMatrixSerpentineLayout =
true;
22uint16_t
XY( uint8_t x, uint8_t y)
26 if( kMatrixSerpentineLayout ==
false) {
27 i = (y * kMatrixWidth) + x;
30 if( kMatrixSerpentineLayout ==
true) {
33 uint8_t reverseX = (kMatrixWidth - 1) - x;
34 i = (y * kMatrixWidth) + reverseX;
37 i = (y * kMatrixWidth) + x;
45CRGB leds[kMatrixWidth * kMatrixHeight];
71uint16_t noise[MAX_DIMENSION][MAX_DIMENSION];
89 for(
int i = 0; i < MAX_DIMENSION; i++) {
90 int ioffset = scale * i;
91 for(
int j = 0; j < MAX_DIMENSION; j++) {
92 int joffset = scale * j;
93 noise[i][j] =
inoise8(x + ioffset,y + joffset,z);
101 static uint8_t ihue=0;
103 for(
int i = 0; i < kMatrixWidth; i++) {
104 for(
int j = 0; j < kMatrixHeight; j++) {
108 leds[
XY(i,j)] =
CHSV(noise[j][i],255,noise[i][j]);
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
uint16_t XY(uint8_t, uint8_t)
Forward declaration of the function "XY" which must be provided by the application for use in two-dim...
uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z)
8-Bit, fixed point implementation of Perlin's noise.
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)