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

◆ loop()

void loop ( )

Definition at line 136 of file Remote.ino.

136 {
137 // Check for incoming JSON RPC via serial and queue it
138 if (Serial.available()) {
139 fl::string jsonRpc = readSerialJson();
140
141 // Parse JSON and queue the request
142 fl::json doc = fl::json::parse(jsonRpc);
143 requestQueue.push_back(doc);
144 }
145
146 // Process all queued requests: pull + tick + push
147 remote.update(millis());
148
149 // Drain response queue and output to serial
150 while (!responseQueue.empty()) {
151 const auto& response = responseQueue[0];
152 Serial.println(response.to_string().c_str());
153 responseQueue.erase(responseQueue.begin());
154 }
155
156 FastLED.show();
157 delay(10);
158}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::string readSerialJson()
Definition Remote.ino:160
fl::vector< fl::json > requestQueue
Definition Remote.ino:32
fl::vector< fl::json > responseQueue
Definition Remote.ino:33
fl::unique_ptr< fl::Remote > remote
Definition RpcClient.ino:43
static json parse(const fl::string &txt) FL_NOEXCEPT
Definition json.h:677
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...
Definition delay.h:98
#define Serial
Definition serial.h:304

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

+ Here is the call graph for this function: