FastLED 3.9.15
Loading...
Searching...
No Matches

◆ write_one_frame()

void write_one_frame ( fl::memorybufPtr memoryStream)
Examples
FxGfx2Video.ino.

Definition at line 44 of file FxGfx2Video.ino.

44 {
45 //memoryStream->seek(0); // Reset to the beginning of the stream
46 uint32_t total_bytes_written = 0;
47 bool toggle = (fl::millis() / 500) % 2 == 0;
48 FL_DBG("Writing frame data, toggle = " << toggle);
49 for (uint32_t i = 0; i < NUM_LEDS; ++i) {
50 fl::CRGB color = (toggle ^ i%2) ? fl::CRGB::Black : fl::CRGB::Red;
51 size_t bytes_written = memoryStream->writeCRGB(&color, 1);
52 if (bytes_written != 1) {
53 FL_DBG("Failed to write frame data, wrote " << bytes_written << " bytes");
54 break;
55 }
56 total_bytes_written += bytes_written;
57 }
58 if (total_bytes_written) {
59 FL_DBG("Frame written, total bytes: " << total_bytes_written);
60 }
61}
#define NUM_LEDS
bool toggle
Definition Blur.ino:12
fl::memorybufPtr memoryStream
fl::CRGB CRGB
Definition crgb.h:25
#define FL_DBG
Definition log.h:388
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
Base definition for an LED controller.
Definition crgb.hpp:179
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

References fl::CRGB::Black, FL_DBG, memoryStream, fl::millis(), NUM_LEDS, fl::CRGB::Red, and toggle.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: