27#include "fx/fx_engine.h"
29#include "fl/file_system.h"
31#include "fl/screenmap.h"
32#include "fl/file_system.h"
39#define LED_TYPE WS2811
40#define COLOR_ORDER GRB
42#define CHIP_SELECT_PIN 5
46#define MATRIX_WIDTH 32
47#define MATRIX_HEIGHT 32
48#define NUM_VIDEO_FRAMES 2
51#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
52#define IS_SERPINTINE true
55Title title(
"SDCard Demo - Mapped Video");
56Description description(
"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 ScreenMap.");
66Slider videoSpeed(
"Video Speed", 1.0f, -1, 2.0f, 0.01f);
74 Serial.println(
"Sketch setup");
75 if (!filesystem.beginSd(CHIP_SELECT_PIN)) {
76 Serial.println(
"Failed to initialize file system.");
84 video = filesystem.openVideo(
"data/video.rgb", NUM_LEDS, FPS, 2);
86 FASTLED_WARN(
"Failed to instantiate video");
90 video2 = filesystem.openVideo(
"data/color_line_bubbles.rgb", NUM_LEDS, FPS, 2);
92 FASTLED_WARN(
"Failed to instantiate video2");
97 bool ok = filesystem.readScreenMap(
"data/screenmap.json",
"strip1", &screenMap);
99 Serial.println(
"Failed to read screen map");
106 .setScreenMap(screenMap);
108 Serial.println(
"FastLED setup done");
112 static bool s_first =
true;
115 Serial.println(
"First loop.");
119 FASTLED_WARN(
"No loop because an error occured.");
123 Video& vid = !bool(whichVideo.value()) ? video : video2;
124 vid.setTimeScale(videoSpeed);
125 uint32_t now = millis();
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
void draw(DrawContext context) override
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Implements a simple red square effect for 2D LED grids.
Demonstrates how to mix noise generation with color palettes on a 2D LED matrix.
Representation of an RGB pixel (Red, Green, Blue)