7#ifndef COMPILE_VIDEO_STREAM
10#define COMPILE_VIDEO_STREAM 0
12#define COMPILE_VIDEO_STREAM 1
16#if COMPILE_VIDEO_STREAM
30#define LED_TYPE WS2811
31#define COLOR_ORDER GRB
33#define MATRIX_WIDTH 22
34#define MATRIX_HEIGHT 22
35#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
39const int BYTES_PER_FRAME = 3 *
NUM_LEDS;
40const int NUM_FRAMES = 2;
41const uint32_t BUFFER_SIZE = BYTES_PER_FRAME * NUM_FRAMES;
43ByteStreamMemoryPtr memoryStream;
49void write_one_frame(ByteStreamMemoryPtr memoryStream) {
51 uint32_t total_bytes_written = 0;
52 bool toggle = (millis() / 500) % 2 == 0;
54 for (uint32_t i = 0; i <
NUM_LEDS; ++i) {
56 size_t bytes_written = memoryStream->writeCRGB(&color, 1);
57 if (bytes_written != 1) {
58 FASTLED_DBG(
"Failed to write frame data, wrote " << bytes_written <<
" bytes");
61 total_bytes_written += bytes_written;
73 memoryStream = ByteStreamMemoryPtr::New(BUFFER_SIZE*
sizeof(
CRGB));
75 video.beginStream(memoryStream);
82 write_one_frame(memoryStream);
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
FxEngine fxEngine(NUM_LEDS)
Manages and renders multiple visual effects (Fx) for LED strips.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
Implements a simple red square effect for 2D LED grids.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Representation of an RGB pixel (Red, Green, Blue)