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

◆ loop()

void loop ( )

Definition at line 231 of file OTA.ino.

231 {
232 // Service OTA (low overhead: ~73µs when idle)
233 ota.poll();
234
235#if USE_WIFI
236 // Async WiFi mode: Show connection status via LEDs
237 if (!ota.isConnected()) {
238 // Connecting: Show pulsing blue animation
239 uint8_t brightness = beatsin8(60, 30, 255); // Pulse at 60 BPM
241 FastLED.setBrightness(brightness);
242 FastLED.show();
243 delay(20);
244 return; // Skip normal animation while connecting
245 } else if (!wifi_connected_notified) {
246 // Just connected: Show success and print info
248 Serial.println("\nWi-Fi connected!");
249 Serial.print("Access web interface at: http://");
250 Serial.print(HOSTNAME);
251 Serial.println(".local/");
252
253 // Brief celebration: Green flash
255 FastLED.setBrightness(255);
256 FastLED.show();
257 delay(500);
258
259 // Restore normal brightness for animation
260 FastLED.setBrightness(50);
261 }
262#endif
263
264 // Normal LED animation (rainbow)
266 FastLED.show();
267
268 hue++;
269
270 // Small delay for animation speed
271 delay(20);
272}
CRGB leds[1]
#define NUM_LEDS
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::net::OTA ota
Definition OTA.ino:117
static const char * HOSTNAME
Definition OTA.ino:105
bool wifi_connected_notified
Definition OTA.ino:229
uint8_t hue
Definition advanced.h:94
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NO_EXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:10
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NO_EXCEPT
Fill a range of LEDs with a rainbow of colors.
Definition fill.cpp.hpp:30
LIB8STATIC u8 beatsin8(accum88 beats_per_minute, u8 lowest=0, u8 highest=255, u32 timebase=0, u8 phase_offset=0) FL_NO_EXCEPT
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
Definition beat.h:105
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
unsigned char uint8_t
Definition stdint.h:208
@ Green
<div style='background:#008000;width:4em;height:4em;'></div>
Definition crgb.h:565
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:519
#define Serial
Definition serial.h:309

References beatsin8(), fl::CRGB::Blue, brightness, FastLED, fill_rainbow(), fill_solid(), fl::CRGB::Green, HOSTNAME, hue, leds, NUM_LEDS, ota, Serial, and wifi_connected_notified.

+ Here is the call graph for this function: