FastLED 3.9.15
Loading...
Searching...
No Matches
FxNoisePlusPalette.ino

This sketch is fully compatible with the FastLED web compiler.

This sketch is fully compatible with the FastLED web compiler. To use it do the following:

  1. Install Fastled: pip install fastled
  2. cd into this examples page.
  3. Run the FastLED web compiler at root: fastled
  4. When the compiler is done a web page will open.
#include <FastLED.h>
#if !SKETCH_HAS_LOTS_OF_MEMORY
// Don't compile this for AVR microcontrollers (like Arduino Uno) because they typically
// don't have enough memory to handle this complex animation.
// Instead, we provide empty setup/loop functions so the sketch will compile but do nothing.
void setup() {}
void loop() {}
#else // For all other platforms with more memory (ESP32, Teensy, etc.)
#include "fl/ui.h"
using namespace fl;
#define LED_PIN 3
#define BRIGHTNESS 96
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define MATRIX_WIDTH 16
#define MATRIX_HEIGHT 16
#if __EMSCRIPTEN__
#define GRID_SERPENTINE 0
#else
#define GRID_SERPENTINE 1
#endif
#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
// This example combines two features of FastLED to produce a remarkable range
// of effects from a relatively small amount of code. This example combines
// FastLED's color palette lookup functions with FastLED's Perlin noise
// generator, and the combination is extremely powerful.
//
// You might want to look at the "ColorPalette" and "Noise" examples separately
// if this example code seems daunting.
//
//
// The basic setup here is that for each frame, we generate a new array of
// 'noise' data, and then map it onto the LED matrix through a color palette.
//
// Periodically, the color palette is changed, and new noise-generation
// parameters are chosen at the same time. In this example, specific
// noise-generation values have been selected to match the given color palettes;
// some are faster, or slower, or larger, or smaller than others, but there's no
// reason these parameters can't be freely mixed-and-matched.
//
// In addition, this example includes some fast automatic 'data smoothing' at
// lower noise speeds to help produce smoother animations in those cases.
//
// The FastLED built-in color palettes (Forest, Clouds, Lava, Ocean, Party) are
// used, as well as some 'hand-defined' ones, and some proceedurally generated
// palettes.
// Scale determines how far apart the pixels in our noise matrix are. Try
// changing these values around to see how it affects the motion of the display.
// The higher the value of scale, the more "zoomed out" the noise iwll be. A
// value of 1 will be so zoomed in, you'll mostly see solid colors.
UISlider SCALE("SCALE", 20, 1, 100, 1);
// We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll
// use the z-axis for "time". speed determines how fast time moves forward. Try
// 1 for a very slow moving effect, or 60 for something that ends up looking
// like water.
UISlider SPEED("SPEED", 30, 1, 60, 1);
void setup() {
delay(1000); // sanity delay
.setCorrection(TypicalLEDStrip);
FastLED.setBrightness(96);
noisePalette.setSpeed(SPEED);
noisePalette.setScale(SCALE);
}
void loop() {
noisePalette.setSpeed(SPEED);
noisePalette.setScale(SCALE);
EVERY_N_MILLISECONDS(5000) { noisePalette.changeToRandomPalette(); }
noisePalette.draw(Fx::DrawContext(millis(), leds));
FastLED.show();
}
#endif // End of the non-AVR code section
CRGB leds[NUM_LEDS]
#define NUM_LEDS
void setup()
void loop()
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
#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