This sketch is fully compatible with the FastLED web compiler.
This sketch is fully compatible with the FastLED web compiler. To use it do the following:
- Install Fastled:
pip install fastled
- cd into this examples page.
- Run the FastLED web compiler at root:
fastled
- When the compiler is done a web page will open.
The render pattern is alternating black/red pixels as a checkerboard. Demonstrates drawing to a frame buffer, which is used as source video for the memory player.
#include <FastLED.h>
#define LED_PIN 2
#define BRIGHTNESS 96
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define MATRIX_WIDTH 22
#define MATRIX_HEIGHT 22
#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
uint32_t total_bytes_written = 0;
for (uint32_t i = 0; i <
NUM_LEDS; ++i) {
if (bytes_written != 1) {
FL_DBG(
"Failed to write frame data, wrote " << bytes_written <<
" bytes");
break;
}
total_bytes_written += bytes_written;
}
if (total_bytes_written) {
FL_DBG(
"Frame written, total bytes: " << total_bytes_written);
}
}
}
}
}
fl::FxEngine fxEngine(NUM_LEDS)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
const uint32_t BUFFER_SIZE
fl::Video video(NUM_LEDS, 2.0f)
fl::memorybufPtr memoryStream
const int BYTES_PER_FRAME
void write_one_frame(fl::memorybufPtr memoryStream)
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.
Centralized logging categories for FastLED hardware interfaces and subsystems.
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Base definition for an LED controller.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Representation of an 8-bit RGB pixel (Red, Green, Blue)