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

◆ loop()

void loop ( )

Definition at line 233 of file OTA.ino.

233 {
234 // Service OTA (low overhead: ~73µs when idle)
235 ota.poll();
236
237#if USE_WIFI
238 // Async WiFi mode: Show connection status via LEDs
239 if (!ota.isConnected()) {
240 // Connecting: Show pulsing blue animation
241 uint8_t brightness = beatsin8(60, 30, 255); // Pulse at 60 BPM
243 FastLED.setBrightness(brightness);
244 FastLED.show();
245 delay(20);
246 return; // Skip normal animation while connecting
247 } else if (!wifi_connected_notified) {
248 // Just connected: Show success and print info
250 Serial.println("\nWi-Fi connected!");
251 Serial.print("Access web interface at: http://");
252 Serial.print(HOSTNAME);
253 Serial.println(".local/");
254
255 // Brief celebration: Green flash
257 FastLED.setBrightness(255);
258 FastLED.show();
259 delay(500);
260
261 // Restore normal brightness for animation
262 FastLED.setBrightness(50);
263 }
264#endif
265
266 // Normal LED animation (rainbow)
268 FastLED.show();
269
270 hue++;
271
272 // Small delay for animation speed
273 delay(20);
274}
#define NUM_LEDS
fl::CRGB leds[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:119
static const char * HOSTNAME
Definition OTA.ino:107
bool wifi_connected_notified
Definition OTA.ino:231
uint8_t hue
Definition advanced.h:94
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NOEXCEPT
Fill a range of LEDs with a rainbow of colors.
Definition fill.cpp.hpp:29
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:9
LIB8STATIC u8 beatsin8(accum88 beats_per_minute, u8 lowest=0, u8 highest=255, u32 timebase=0, u8 phase_offset=0) FL_NOEXCEPT
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_NOEXCEPT
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 s16x16x4.h:209
@ Green
<div style='background:#008000;width:4em;height:4em;'></div>
Definition crgb.h:558
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:512
#define Serial
Definition serial.h:304

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: