FastLED 3.9.15
Loading...
Searching...
No Matches
Overclock.ino
Go to the documentation of this file.
1// @filter: (memory is large)
2
12
14
15// FASTLED_OVERCLOCK must be defined BEFORE including FastLED.h so the value
16// reaches led_timing.h's `#ifndef` guard. Defining it after include causes a
17// -Wmacro-redefined warning on every CI build. (#2728)
18#define FASTLED_OVERCLOCK 1.1 // Overclocks by 10%, I've seen 25% work fine.
19#define FASTLED_OVERCLOCK_SUPPRESS_WARNING 1
20
21#include "FastLED.h"
22
24#include "fl/fx/fx.h"
25
26
27
28#define LED_PIN 3
29#define BRIGHTNESS 96
30#define LED_TYPE WS2811
31#define COLOR_ORDER GRB
32
33#define MATRIX_WIDTH 22
34#define MATRIX_HEIGHT 22
35#define GRID_SERPENTINE 1
36
37#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
38
39// This example combines two features of FastLED to produce a remarkable range
40// of effects from a relatively small amount of code. This example combines
41// FastLED's color palette lookup functions with FastLED's Perlin noise
42// generator, and the combination is extremely powerful.
43//
44// You might want to look at the "ColorPalette" and "Noise" examples separately
45// if this example code seems daunting.
46//
47//
48// The basic setup here is that for each frame, we generate a new fl::array of
49// 'noise' data, and then map it onto the LED matrix through a color palette.
50//
51// Periodically, the color palette is changed, and new noise-generation
52// parameters are chosen at the same time. In this example, specific
53// noise-generation values have been selected to match the given color palettes;
54// some are faster, or slower, or larger, or smaller than others, but there's no
55// reason these parameters can't be freely mixed-and-matched.
56//
57// In addition, this example includes some fast automatic 'data smoothing' at
58// lower noise speeds to help produce smoother animations in those cases.
59//
60// The FastLED built-in color palettes (Forest, Clouds, Lava, Ocean, Party) are
61// used, as well as some 'hand-defined' ones, and some proceedurally generated
62// palettes.
63
64// Scale determines how far apart the pixels in our noise matrix are. Try
65// changing these values around to see how it affects the motion of the display.
66// The higher the value of scale, the more "zoomed out" the noise iwll be. A
67// value of 1 will be so zoomed in, you'll mostly see solid colors.
68#define SCALE 20
69
70// We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll
71// use the z-axis for "time". speed determines how fast time moves forward. Try
72// 1 for a very slow moving effect, or 60 for something that ends up looking
73// like water.
74#define SPEED 30
75
79
80
81void setup() {
82 delay(1000); // sanity delay
84 .setCorrection(TypicalLEDStrip).setScreenMap(xyMap);
85 FastLED.setBrightness(96);
86 noisePalette.setSpeed(SPEED);
87 noisePalette.setScale(SCALE);
88}
89
90void loop() {
91 EVERY_N_MILLISECONDS(5000) { noisePalette.changeToRandomPalette(); }
93 FastLED.show();
94}
#define COLOR_ORDER
#define MATRIX_HEIGHT
fl::XYMap xyMap
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define LED_PIN
#define MATRIX_WIDTH
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
#define GRID_SERPENTINE
#define SCALE
Definition Overclock.ino:68
void setup()
Definition Overclock.ino:81
fl::XYMap xyMap(MATRIX_WIDTH, MATRIX_HEIGHT, GRID_SERPENTINE)
#define SPEED
Definition Overclock.ino:74
void loop()
Definition Overclock.ino:90
fl::NoisePalette noisePalette(xyMap)
#define LED_TYPE
::fl::DrawContext DrawContext
Definition fx.h:21
fl::CRGBPalette16 noisePalette
Definition curr.h:243
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
Definition lib8tion.h:1045
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
Demonstrates how to mix noise generation with color palettes on a 2D LED matrix.
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38