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
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}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
int y
Definition simple.h:93
int x
Definition simple.h:92
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
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
constexpr EOrder GRB
Definition eorder.h:19
fl::CRGB CRGB
Definition crgb.h:25
void fill_2dnoise16(CRGB *leds, int width, int height, bool serpentine, fl::u8 octaves, fl::u32 x, int xscale, fl::u32 y, int yscale, fl::u32 time, fl::u8 hue_octaves, fl::u16 hue_x, int hue_xscale, fl::u16 hue_y, fl::u16 hue_yscale, fl::u16 hue_time, bool blend, fl::u16 hue_shift)
Fill an LED matrix with random colors, using 16-bit noise.
LIB8STATIC void random16_add_entropy(fl::u16 entropy) FL_NOEXCEPT
Add entropy into the random number generator.
Definition random8.h:110
LIB8STATIC void random16_set_seed(fl::u16 seed) FL_NOEXCEPT
Set the 16-bit seed used for the random number generator.
Definition random8.h:104
LIB8STATIC fl::u16 random16() FL_NOEXCEPT
Generate a 16-bit random number.
Definition random8.h:63
#define Serial
Definition serial.h:304