This document maps the example sketches, shows how to run them on different targets (Arduino/PlatformIO, Teensy, ESP32, WASM), and suggests learning paths. It mirrors the structure and tone of src/fl/README.md so you can quickly jump between concepts and runnable code.
- Overview and Quick Start
- How to Run Examples
- Directory Map (by theme)
- Quick Usage Notes
- Choosing an Example
- Troubleshooting
- Guidance for New Users
- Guidance for C++ Developers
The examples/ directory contains runnable sketches that cover:
- Getting started (blinking, first LED, pin modes)
- Color utilities, palettes, and HSV/CRGB conversions
- Classic 1D effects (Cylon, Fire, Twinkles, DemoReel100)
- 2D matrix helpers, XY mapping, and raster effects
- Advanced pipelines like downscale/upscale and path rendering
- Platform-specific demos (Teensy OctoWS2811, ESP I2S)
- Browser/WASM examples with JSON-driven UI controls
Typical first steps:
- Open an example in the Arduino IDE and change
NUM_LEDS, chipset, andDATA_PINto match hardware - For matrices, define width/height and choose serpentine vs. row-major mapping
- For WASM or host exploration, use the WASM examples or the STUB platform (see below)
- Open an
.inofile directly (e.g.,examples/Blink/Blink.ino) - Edit the configuration near the top:
- LED type:
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS) - Strip length:
NUM_LEDS - Brightness:
FastLED.setBrightness(…)
- LED type:
- Select your board and COM/serial port, then Upload
Tips:
- For 2D examples, set
WIDTH/HEIGHTand confirm wiring (serpentine vs. linear) - If the animation is mirrored or offset, adjust the mapping helper
- Board-based workflows: create a
platformio.inithat targets your MCU and copy an example sketch into a projectsrc/folder - Host/STUB workflows: use the STUB platform for local testing where appropriate (no hardware); advanced builds hook into
src/platforms/stub/
The repository includes ci/native/ and ci/kitchensink/ PlatformIO configs you can reference for host builds and integration tests.
- Examples under
examples/SpecialDrivers/Teensy/OctoWS2811/*and related Teensy demos show multi-output patterns - Replace pin/channel configuration and buffer sizes to match your wiring; ensure you select the correct Teensy model in your IDE/toolchain
- See
examples/SpecialDrivers/ESP/for all ESP32 special drivers:I2S/- I2S-based parallel output for ESP32 and ESP32-S3LCD_I80/- LCD I80 peripheral for ESP32-S2/S3LCD_RGB/- LCD RGB peripheral for ESP32-P4Parlio/- Parallel IO driver for ESP32-P4
- These demonstrate high-throughput hardware-accelerated output; choose a board definition matching your dev board and wiring
- On some environments, parallel output requires specific pin sets and PSRAM settings; consult the sketch notes
examples/wasm/and related WASM-focused examples run in the browser- The JSON UI system enables sliders, buttons, and other controls (see
src/platforms/wasmandsrc/fl/ui.h) - Typical flow: build to WebAssembly, serve the app, and interact via the browser UI
This list highlights commonly used examples. It is not exhaustive—browse the folders for more.
Blink/— minimal starting pointFirstLight/— walk a single bright pixel along the stripPinMode/— simple input pin usageRGBSetDemo/— basic pixel addressing and assignmentRGBCalibrate/— adjust color channel balance
ColorPalette/— palette usage and transitionsColorTemperature/— white point and temperature helpersHSVTest/— HSV types and conversionsColorBoost/— saturation/luminance shaping for high visual impact
Cylon/,FxCylon/— scanning eye; FX variants use higher-level helpersFire2012/,Fire2012WithPalette/,FxFire2012/— classic fire effectTwinkleFox/,FxTwinkleFox/— twinkling star fieldsPride2015/,FxPride2015/— rainbow variantsDemoReel100/,FxDemoReel100/— rotating showcase of many patternsWave/— 1D wave toolkit
XYMatrix/— matrix mapping helpers and layoutsWave2d/,FxWave2d/— 2D wavefieldsBlur2d/— separable blur across a matrixDownscale/— render high-res, resample to panel resolutionAnimartrix/— animated matrix patterns and helpersSmartMatrix/— SmartMatrix integration sketch
FxEngine/— scaffolding for composing layers and framesFxGfx2Video/— utilities to pipe graphics into frame/video helpersfx/undersrc/provides the building blocks used by these examples
Audio/— audio input + analysis (simple and advanced variants)Ports/PJRCSpectrumAnalyzer/— Teensy-centric spectrum analyzer
FxSdCard/— SD-backed media and assets (seedata/subfolder)
Multiple/— organize multiple arrays/segmentsTeensyParallel/— multi-output example- See
SpecialDrivers/for platform-specific high-performance drivers (ESP, Teensy, Adafruit)
- See
SpecialDrivers/ESP/for ESP32 parallel drivers (LCD, I2S, Parlio) - See
SpecialDrivers/Teensy/for Teensy parallel drivers (OctoWS2811, ObjectFLED) SmartMatrix/— run on SmartMatrix hardware
wasm/— browser-targeted demoWasmScreenCoords/— UI overlay and coordinate visualizationJson/— JSON-structured sketch exampleUITest/— showcase of JSON UI controls and groups
LuminescentGrand/— complex, multi-file installation pieceLuminova/— larger effect setChromancer/— advanced example with assets and helpers
- Always set the LED chipset, pin, color order, and
NUM_LEDSto match your hardware:FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);- Common CHIPSETs:
WS2812B,SK6812,APA102(APA102 also needsCLK_PIN)
- Adjust brightness and power:
FastLED.setBrightness(…)and consider power limits for dense strips - For matrices, define
WIDTH/HEIGHTand use serpentine or row-major helpers; verify orientation - Prefer using
fl::Leds+XYMapfor 2D logic when the example exposes those hooks - For high quality on low-res displays, render at higher resolution and
downscale
- New to FastLED: start with
Blink→FirstLight→DemoReel100 - Building a palette-based animation:
ColorPaletteandColorTemperature - Making a 1D animation:
Cylon,Fire2012,TwinkleFox - Driving a panel:
XYMatrix, then tryDownscaleorWave2d - Multi-output / high-density:
OctoWS2811Demo,TeensyParallel - Browser demo / UI:
wasm,UITest,Json - Advanced/experimental:
Corkscrew(insrc/fl),Fx*examples, andChromancer
- Nothing lights up:
- Re-check
DATA_PIN, chipset, andCOLOR_ORDER - Confirm
NUM_LEDSand power are correct; try a low brightness first
- Re-check
- Colors look wrong: try
GRBvs.RGBordering; some strips invert green/red - Matrix appears mirrored or wrapped: change serpentine/row-major mapping or flip
WIDTHandHEIGHT - ESP32 I2S pinning: verify the chosen pins are valid for your board’s I2S peripheral
- Teensy multi-output: confirm channel count and buffer sizes match your wiring
- Include
FastLED.h, pick your chipset, setNUM_LEDS, and get something simple running first - For matrices, draw into width/height coordinates and let mapping/wiring helpers translate to indices
- Explore the palette and HSV examples for smooth color; try
fill_rainbowandCHSV - When moving to larger builds, consider splitting configuration and effect code into separate files for clarity
- Many examples are deliberately small; for more reusable building blocks, see
src/fl/andsrc/fx/ - Prefer
fl::containers, views (fl::span), and graphics helpers for portability and quality - For UI/remote control on capable targets, use the JSON UI elements (see
src/fl/ui.h) and WASM bridge (src/platforms/wasm)
This README will evolve alongside the examples. Browse subfolders for sketch-specific notes and hardware details. For the core library map and deeper subsystems, see src/README.md and src/fl/README.md.