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