FastLED 3.9.15
Loading...
Searching...
No Matches
NoisePlayground.ino
Go to the documentation of this file.
1
2
3
7
8#include <FastLED.h>
9
10#if defined(__AVR__)
11// too large for ATtiny85, attiny88, etc.. Just disable it for all avr boards.
12void setup() {};
13void loop() {};
14#else
15
16// Params for width and height
17const uint8_t kMatrixWidth = 16;
18const uint8_t kMatrixHeight = 16;
19
20#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
21
22// Param for different pixel layouts
23#define kMatrixSerpentineLayout true
24
25// led array
27
28// x,y, & time values
30
31// Play with the values of the variables below and see what kinds of effects they
32// have! More octaves will make things slower.
33
34// how many octaves to use for the brightness and hue functions
35uint8_t octaves=1;
36uint8_t hue_octaves=3;
37
38// the 'distance' between points on the x and y axis
39int xscale=57771;
40int yscale=57771;
41
42// the 'distance' between x/y points for the hue noise
44
45// how fast we move through time & hue noise
46int time_speed=1111;
47int hue_speed=31;
48
49// adjust these values to move along the x or y axis between frames
50int x_speed=331;
51int y_speed=1111;
52
53void loop() {
54 // fill the led array 2/16-bit noise values
58
59 FastLED.show();
60
61 // adjust the intra-frame time values
62 x += x_speed;
63 y += y_speed;
66 // delay(50);
67}
68
69
70void setup() {
71 // initialize the x/y and time values
73 random16_add_entropy(analogRead(3));
74
75 Serial.begin(57600);
76 Serial.println("resetting!");
77
78 delay(3000);
79 FastLED.addLeds<WS2811,2,GRB>(leds,NUM_LEDS);
80 FastLED.setBrightness(96);
81
82 hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
83 x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
84 y = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
85 v_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
86 hue_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();
87
88}
89
90#endif
void setup()
void loop()
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
int y_speed
uint8_t hue_octaves
int time_speed
#define kMatrixSerpentineLayout
int hue_speed
int yscale
uint8_t octaves
int x_speed
int xscale
int hue_scale
uint32_t hue_time
uint32_t hxy
uint32_t v_time
#define kMatrixHeight
#define kMatrixWidth
WS2811 controller class.
Definition FastLED.h:241
@ 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:964
LIB8STATIC void random16_add_entropy(uint16_t entropy)
Add entropy into the random number generator.
Definition random8.h:101
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
Definition random8.h:54
LIB8STATIC void random16_set_seed(uint16_t seed)
Set the 16-bit seed used for the random number generator.
Definition random8.h:95
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54