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