|
FastLED 3.9.15
|
Play a mapped video off an SD card.
This sketch supports two on-disk formats:
*.fled) — preferred. A single self- describing file that carries both the raw RGB frames and the ScreenMap that maps them onto the physical LED layout. No sidecar .json needed; the mapping travels in the file's 12-byte header. Spec: https://github.com/zackees/ledmapper/blob/main/docs/fled-format.md.rgb + sidecar screenmap.json — kept working for backward compatibility. If no .fled file is on the SD card, the sketch falls back to the old pairing.Compatible with the FastLED web compiler:
pip install fastledcd into this example dirfastled at the repo root opens a browser-based runner. Definition in file FxSdCard.ino.
#include "FastLED.h"#include "Arduino.h"#include "fl/fx/2d/noisepalette.h"#include "fl/fx/fx_engine.h"#include "fl/fx/video.h"#include "fl/system/file_system.h"#include "fl/ui/ui.h"#include "fl/math/screenmap.h"
Include dependency graph for FxSdCard.ino:Go to the source code of this file.
Macros | |
| #define | CHIP_SELECT_PIN 5 |
| #define | COLOR_ORDER GRB |
| #define | FPS 60 |
| #define | IS_SERPINTINE true |
| #define | LED_PIN 2 |
| #define | LED_TYPE WS2811 |
| #define | MATRIX_HEIGHT 32 |
| #define | MATRIX_WIDTH 32 |
| #define | NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT) |
| #define | NUM_VIDEO_FRAMES 2 |
Functions | |
| void | loop () |
| fl::Video | openVideoEitherFormat (const char *fledPath, const char *rgbPath, const char *sidecarScreenmapPath, fl::ScreenMap *outScreenMap) |
| void | setup () |
| static bool | validateScreenMapSize (const fl::ScreenMap &m, const char *source) |
| UINumberField | whichVideo ("Which fl::Video", 0, 0, 1) |
Variables | |
| fl::UIDescription | description ("fl::Video data is streamed off of a SD card and displayed on a LED strip. The video data is mapped to the LED strip using a fl::ScreenMap embedded in the FLED file (with a sidecar screenmap.json fallback for legacy .rgb files).") |
| fl::FileSystem | filesystem |
| bool | gError = false |
| fl::CRGB | leds [NUM_LEDS] |
| fl::ScreenMap | screenMap |
| fl::UITitle | title ("SDCard Demo - Mapped fl::Video") |
| fl::Video | video |
| fl::Video | video2 |
| fl::UISlider | videoSpeed ("fl::Video Speed", 1.0f, -1, 2.0f, 0.01f) |