FastLED 3.9.15
Loading...
Searching...
No Matches
NoisePlayground.h
Go to the documentation of this file.
1
2
3
7
8#include <FastLED.h>
9
10
11// Params for width and height
12const uint8_t kMatrixWidth = 16;
13const uint8_t kMatrixHeight = 16;
14
15#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
16
17// Param for different pixel layouts
18#define kMatrixSerpentineLayout true
19
20// led array
22
23// x,y, & time values
25
26// Play with the values of the variables below and see what kinds of effects they
27// have! More octaves will make things slower.
28
29// how many octaves to use for the brightness and hue functions
30uint8_t octaves=1;
31uint8_t hue_octaves=3;
32
33// the 'distance' between points on the x and y axis
34int xscale=57771;
35int yscale=57771;
36
37// the 'distance' between x/y points for the hue noise
39
40// how fast we move through time & hue noise
41int time_speed=1111;
42int hue_speed=31;
43
44// adjust these values to move along the x or y axis between frames
45int x_speed=331;
46int y_speed=1111;
47
48
49
50void setup() {
51 // initialize the x/y and time values
53 random16_add_entropy(analogRead(3));
54
55 Serial.begin(57600);
56 Serial.println("resetting!");
57
58 delay(3000);
59 FastLED.addLeds<WS2811,2,GRB>(leds,NUM_LEDS);
60 FastLED.setBrightness(96);
61
62 hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
63 x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
64 y = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
65 v_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
66 hue_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
67}
68
69void loop() {
70 // fill the led array 2/16-bit noise values
74
75 FastLED.show();
76
77 // adjust the intra-frame time values
78 x += x_speed;
79 y += y_speed;
82 // delay(50);
83}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:62
central include file for FastLED, defines the CFastLED class/object
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:83
int y_speed
uint8_t hue_octaves
int time_speed
#define kMatrixSerpentineLayout
int hue_speed
int yscale
uint8_t octaves
void setup()
int x_speed
int xscale
int hue_scale
uint32_t hue_time
uint32_t hxy
uint32_t v_time
void loop()
#define kMatrixHeight
#define kMatrixWidth
WS2811 controller class.
Definition FastLED.h:258
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
void fill_2dnoise16(CRGB *leds, int width, int height, bool serpentine, uint8_t octaves, uint32_t x, int xscale, uint32_t y, int yscale, uint32_t time, uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale, uint16_t hue_time, bool blend, uint16_t hue_shift)
Fill an LED matrix with random colors, using 16-bit noise.
Definition noise.cpp:938
LIB8STATIC void random16_add_entropy(uint16_t entropy)
Add entropy into the random number generator.
Definition random8.h:103
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
Definition random8.h:56
LIB8STATIC void random16_set_seed(uint16_t seed)
Set the 16-bit seed used for the random number generator.
Definition random8.h:97
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55