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

◆ setup()

void setup ( )

Definition at line 79 of file Loopback.ino.

79 {
80 Serial.begin(115200);
81 Serial.println("HTTP Server Loopback Test");
82
83 // Initialize LED strip
84 FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
85 FastLED.setBrightness(64);
86
87 // Register HTTP server routes inline (clear and simple)
88 server.get("/", [](const fl::http_request& req) {
89 return fl::http_response::ok("Hello from loopback test!\n");
90 });
91
92 server.get("/ping", [](const fl::http_request& req) {
93 return fl::http_response::ok("pong\n");
94 });
95
96 server.get("/test", [](const fl::http_request& req) {
97 return fl::http_response::ok("test response\n");
98 });
99
100 // Start HTTP server
101 if (server.start(8080)) {
102 Serial.println("Server started on http://localhost:8080/");
105 } else {
106 Serial.println("ERROR: Failed to start server");
107 Serial.print("Error: ");
108 Serial.println(server.last_error().c_str());
109 state = FAILED;
110 }
111
112 updateLEDs();
113 FastLED.show();
114}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define DATA_PIN
Definition ClientReal.h:82
fl::HttpServer server
TestState state
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
void updateLEDs()
Definition Loopback.ino:54
@ WAITING_FOR_TESTS
Definition Loopback.ino:44
uint32_t startup_time
Definition Loopback.ino:51
static Response ok(const string &body="")
Factory method for 200 OK response.
constexpr EOrder GRB
Definition eorder.h:19
asio::http::Request http_request
Definition server.h:280
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
#define Serial
Definition serial.h:304

References DATA_PIN, FAILED, FastLED, GRB, leds, fl::millis(), NUM_LEDS, fl::asio::http::Response::ok(), Serial, server, startup_time, state, updateLEDs(), and WAITING_FOR_TESTS.

+ Here is the call graph for this function: