FastLED 3.10.8
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 137 of file Remote.ino.

137 {
138 // Check for incoming JSON RPC via serial and queue it
139 if (Serial.available()) {
140 fl::string jsonRpc = readSerialJson();
141
142 // Parse JSON and queue the request
143 fl::json doc = fl::json::parse(jsonRpc);
144 requestQueue.push_back(doc);
145 }
146
147 // Process all queued requests: pull + tick + push
148 remote.update(millis());
149
150 // Drain response queue and output to serial
151 while (!responseQueue.empty()) {
152 const auto& response = responseQueue[0];
153 Serial.println(response.to_string().c_str());
154 responseQueue.erase(responseQueue.begin());
155 }
156
157 FastLED.show();
158 delay(10);
159}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::string readSerialJson()
Definition Remote.ino:161
fl::vector< fl::json > requestQueue
Definition Remote.ino:33
fl::vector< fl::json > responseQueue
Definition Remote.ino:34
fl::unique_ptr< fl::Remote > remote
Definition RpcClient.ino:43
static json parse(const fl::string &txt) FL_NO_EXCEPT
Definition json.h:842
void delay(u32 ms, bool run_async=true) FL_NO_EXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
#define Serial
Definition serial.h:309

References FastLED, fl::json::parse(), readSerialJson(), remote, requestQueue, responseQueue, and Serial.

+ Here is the call graph for this function: