|
FastLED 3.9.15
|
Example demonstrating fl::Remote RPC system with callback-based I/O.
This example shows how to:
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
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::json > | requestQueue |
| fl::vector< fl::json > | responseQueue |