examples/README.md
examples/)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.
The examples/ directory contains runnable sketches that cover:
Typical first steps:
NUM_LEDS, chipset, and DATA_PIN to match hardware.ino file directly (e.g., examples/Blink/Blink.ino)FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS)NUM_LEDSFastLED.setBrightness(β¦)Tips:
WIDTH/HEIGHT and confirm wiring (serpentine vs. linear)platformio.ini that targets your MCU and copy an example sketch into a project src/ foldersrc/platforms/stub/meson.build and run uv run test.py --cpp)examples/SpecialDrivers/Teensy/OctoWS2811/* and related Teensy demos show multi-output patternsexamples/SpecialDrivers/ESP/ for ESP32 special driver examples:
DriverTest/ - Tests all available LED drivers for your ESP32 variant (RMT, SPI, I2S, PARLIO, UART, LCD_RGB)examples/wasm/ and related WASM-focused examples run in the browsersrc/platforms/wasm and src/fl/ui.h)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 balanceColorPalette/ β palette usage and transitionsColorTemperature/ β white point and temperature helpersHSVTest/ β HSV types and conversionsColorBoost/ β saturation/luminance shaping for high visual impactCylon/, 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 toolkitXYMatrix/ β 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 sketchFxEngine/ β scaffolding for composing layers and framesFxGfx2Video/ β utilities to pipe graphics into frame/video helpersfx/ under src/ provides the building blocks used by these examplesAudio/ β audio input + analysis (simple and advanced variants)AudioInput/ β I2S microphone input (ESP32 & Teensy, INMP441 compatible)Ports/PJRCSpectrumAnalyzer/ β Teensy-centric spectrum analyzerFxSdCard/ β SD-backed media and assets (see data/ subfolder)Multiple/ β organize multiple arrays/segmentsTeensyParallel/ β multi-output exampleSpecialDrivers/ for platform-specific high-performance drivers (ESP, Teensy, Adafruit)SpecialDrivers/ESP/DriverTest/ for ESP32 driver testing (tests RMT, SPI, I2S, PARLIO, UART, LCD_RGB based on your variant)SpecialDrivers/Teensy/ for Teensy parallel drivers (OctoWS2811, ObjectFLED)SmartMatrix/ β run on SmartMatrix hardwarewasm/ β browser-targeted demoWasmScreenCoords/ β UI overlay and coordinate visualizationJson/ β JSON-structured sketch exampleUITest/ β showcase of JSON UI controls and groupsLuminescentGrand/ β complex, multi-file installation pieceLuminova/ β larger effect setChromancer/ β advanced example with assets and helpersFastLED now supports flexible @filter directives in .ino sketch files for conditional compilation based on platform, memory, target, and board properties. This enables you to maintain platform-specific examples without duplicating code.
One-liner format (compact, flexible):
// @filter (memory is high) and (platform is esp32s3)
// @filter (mem is high) and (plat is esp32*)
// @filter (mem: high) and (plat: esp32)
// @filter (mem=high) and (plat=esp32)
Multi-line YAML format (explicit):
// @filter
// - require:
// - platform: esp32s3
// - memory: high
// - exclude:
// - platform: avr
// @end-filter
Operators:
is / is not - Exact match (supports wildcards with *)= / : - Shorthand for ismatches - Regex/glob pattern matchProperty shortcuts:
mem β memoryplat β platformtgt β targetbrd β boardLogical operators: and, or
Examples:
// @filter (platform is esp32*)
// @filter (memory is not low)
// @filter (target is -D__AVR__) or (board is uno)
NUM_LEDS to match your hardware:
FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);WS2812B, SK6812, APA102 (APA102 also needs CLK_PIN)FastLED.setBrightness(β¦) and consider power limits for dense stripsWIDTH/HEIGHT and use serpentine or row-major helpers; verify orientationfl::Leds + XYMap for 2D logic when the example exposes those hooksdownscaleBlink β FirstLight β DemoReel100ColorPalette and ColorTemperatureCylon, Fire2012, TwinkleFoxXYMatrix, then try Downscale or Wave2dOctoWS2811Demo, TeensyParallelwasm, UITest, JsonCorkscrew (in src/fl), Fx* examples, and ChromancerDATA_PIN, chipset, and COLOR_ORDERNUM_LEDS and power are correct; try a low brightness firstGRB vs. RGB ordering; some strips invert green/redWIDTH and HEIGHTFastLED.h, pick your chipset, set NUM_LEDS, and get something simple running firstfill_rainbow and CHSVsrc/fl/ and src/fx/fl:: containers, views (fl::span), and graphics helpers for portability and qualitysrc/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.