| 88 | static int approach_counter = 0; // Cycle through 4 different approaches |
| 89 | |
| 90 | void setup() { |
| 91 | // Initialize LED strip |
| 92 | FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS); |
| 93 | |
| 94 | // Set all LEDs to dark red initially (indicates waiting/starting state) |
| 95 | fill_solid(leds, NUM_LEDS, fl::CRGB(64, 0, 0)); // Dark red = starting up |
| 96 | FastLED.show(); |
| 97 | |
| 98 | // Tutorial introduction messages |
| 99 | FL_WARN("FastLED Networking Tutorial started - 10 LEDs set to dark red"); |
| 100 | FL_WARN("Learning HTTP fetch API with TWO different async patterns:"); |
| 101 | FL_WARN(" APPROACH 1: Promise-based (.then/.catch_) with explicit types"); |
| 102 | FL_WARN(" APPROACH 2: fl::task::await_top_level pattern with explicit types"); |
| 103 | FL_WARN("Toggles between approaches every 10 seconds for comparison..."); |
| 104 | FL_WARN("LED colors indicate status: Red=Error, Green=Promise Success, Blue=Await Success"); |
| 105 | } |
| 106 | |
| 107 | // APPROACH 1: Promise-based async pattern (JavaScript-like) |
| 108 | // This approach uses method chaining and callbacks - very common in web development |
nothing calls this directly
no test coverage detected