10#include <SmartMatrix.h>
13#define kMatrixWidth 32
14#define kMatrixHeight 32
15const bool kMatrixSerpentineLayout =
false;
17#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
19CRGB leds[kMatrixWidth * kMatrixHeight];
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;
68uint8_t noise[kMatrixWidth][kMatrixHeight];
94 for(
int i = 0; i < kMatrixWidth; i++) {
95 int ioffset = scale * i;
96 for(
int j = 0; j < kMatrixHeight; j++) {
97 int joffset = scale * j;
98 noise[i][j] =
inoise8(x + ioffset,y + joffset,z);
106 static uint8_t circlex = 0;
107 static uint8_t circley = 0;
109 static uint8_t ihue=0;
111 for(
int i = 0; i < kMatrixWidth; i++) {
112 for(
int j = 0; j < kMatrixHeight; j++) {
116 leds[XY(i,j)] =
CHSV(noise[j][i],255,noise[i][j]);
void * pSmartMatrix
Pointer to the matrix object when using the Smart Matrix Library.
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.
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)