FastLED 3.9.15
Loading...
Searching...
No Matches
Remote.ino File Reference

Detailed Description

Example demonstrating fl::Remote RPC system with callback-based I/O.

This example shows how to:

  • Register functions that can be called remotely via JSON
  • Use callback-based I/O with RequestSource/ResponseSink
  • Execute functions immediately or schedule them for later
  • Query system state and return JSON values

Send JSON commands via serial, for example: Commands (no return): {"function":"fill","args":[255,0,0]} {"timestamp":5000,"function":"setBrightness","args":[64]}

Queries (with return): {"function":"millis","args":[]} -> returns current time {"function":"getStatus","args":[]} -> returns system status {"function":"getLed","args":[0]} -> returns LED color

See also
fl/remote/remote.h for full API documentation

Definition in file Remote.ino.

#include <FastLED.h>
+ Include dependency graph for Remote.ino:

Go to the source code of this file.

Macros

#define DATA_PIN   3
 
#define NUM_LEDS   10
 

Functions

void loop ()
 
fl::string readSerialJson ()
 
void setup ()
 

Variables

CRGB leds [NUM_LEDS]
 
fl::Remote remote ([]() -> fl::optional< fl::json > { if(requestQueue.empty()) { return fl::nullopt;} auto req=fl::move(requestQueue[0]);requestQueue.erase(requestQueue.begin());return req;}, [](const fl::json &response) { responseQueue.push_back(response);})
 
fl::vector< fl::jsonrequestQueue
 
fl::vector< fl::jsonresponseQueue