FastLED 3.10.6
Loading...
Searching...
No Matches
FxLedmapper32x32.ino

This sketch mirrors the SD-backed video flow in FASTLED4 and points it at a ledmapper.com-style 32x32 asset at data/video1.rgb.

This sketch mirrors the SD-backed video flow in FASTLED4 and points it at a ledmapper.com-style 32x32 asset at data/video1.rgb.video1.rgb is NOT committed to this repo. It is hosted in FastLED/assets and referenced by the sidecar data/video1.rgb.lnk (fbuild JSON descriptor with url/sha256/size) resolved at build time. See data/readme.txt for the fetch command (fbuild lnk pull).

The preview screen map is loaded from data/screenmap.json, sourced from the ledmapper 32x32 quad serpentine preset, and is kept local because it is small.

// @filter: (memory is large)
#include "FastLED.h"
#include "Arduino.h"
#include "fl/fx/video.h"
#include "fl/ui/ui.h"
#ifndef LED_PIN
#define LED_PIN 2
#endif
#ifndef CHIP_SELECT_PIN
#define CHIP_SELECT_PIN 5
#endif
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define MATRIX_WIDTH 32
#define MATRIX_HEIGHT 32
#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
#define VIDEO_FPS 30
#define VIDEO_FRAME_HISTORY 2
#define DEFAULT_BRIGHTNESS 96
fl::UITitle title("Ledmapper 32x32 Video");
"Streams data/video1.rgb as a 32x32 mapped raw RGB asset. "
"Change VIDEO_FPS if the export was authored at a different frame rate.");
fl::UISlider brightness("Brightness", DEFAULT_BRIGHTNESS, 0, 255, 1);
fl::UISlider playbackSpeed("Playback Speed", 1.0f, -2.0f, 2.0f, 0.01f);
bool gError = false;
void setup() {
Serial.begin(115200);
Serial.println("FxLedmapper32x32 setup");
if (!filesystem.beginSd(CHIP_SELECT_PIN)) {
Serial.println("Failed to initialize file system.");
gError = true;
return;
}
if (!filesystem.readScreenMap("data/screenmap.json", "strip1", &screenMap)) {
Serial.println("Failed to read data/screenmap.json");
gError = true;
return;
}
.setCorrection(TypicalLEDStrip)
.setScreenMap(screenMap);
FastLED.setBrightness(DEFAULT_BRIGHTNESS);
video = filesystem.openVideo("data/video1.rgb", NUM_LEDS, VIDEO_FPS,
if (!video) {
FL_WARN("Failed to open data/video1.rgb");
gError = true;
return;
}
FastLED.show();
Serial.println("FxLedmapper32x32 ready");
}
void loop() {
if (gError) {
FL_WARN("FxLedmapper32x32 halted due to setup error.");
}
return;
}
FastLED.setBrightness(static_cast<uint8_t>(brightness.value()));
video.setTimeScale(playbackSpeed.value());
video.draw(fl::millis(), leds);
FastLED.show();
}
CRGB leds[1]
void setup()
void loop()
#define COLOR_ORDER
#define NUM_LEDS
fl::UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
fl::UITitle title("Animartrix")
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
#define LED_PIN
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::Video video(NUM_LEDS, 2.0f)
fl::FileSystem filesystem
#define VIDEO_FRAME_HISTORY
fl::UISlider playbackSpeed("Playback Speed", 1.0f, -2.0f, 2.0f, 0.01f)
bool gError
#define VIDEO_FPS
#define CHIP_SELECT_PIN
#define DEFAULT_BRIGHTNESS
#define LED_TYPE
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NO_EXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:9
fl::ScreenMap screenMap
Definition Corkscrew.h:101
Compatibility forwarder.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Definition lib8tion.h:1009
#define FL_WARN(...)
Definition log.h:440
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
unsigned char uint8_t
Definition stdint.h:208
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38
#define Serial
Definition serial.h:304
Aggregator header for the fl/ui/ family of per-element UI types.