FastLED 3.10.9
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 232 of file OTA.ino.

232 {
233 // Service OTA (low overhead: ~73µs when idle)
234 ota.poll();
235
236#if USE_WIFI
237 // Async WiFi mode: Show connection status via LEDs
238 if (!ota.isConnected()) {
239 // Connecting: Show pulsing blue animation
240 uint8_t brightness = beatsin8(60, 30, 255); // Pulse at 60 BPM
242 FastLED.setBrightness(brightness);
243 FastLED.show();
244 delay(20);
245 return; // Skip normal animation while connecting
246 } else if (!wifi_connected_notified) {
247 // Just connected: Show success and print info
249 Serial.println("\nWi-Fi connected!");
250 Serial.print("Access web interface at: http://");
251 Serial.print(HOSTNAME);
252 Serial.println(".local/");
253
254 // Brief celebration: Green flash
256 FastLED.setBrightness(255);
257 FastLED.show();
258 delay(500);
259
260 // Restore normal brightness for animation
261 FastLED.setBrightness(50);
262 }
263#endif
264
265 // Normal LED animation (rainbow)
267 FastLED.show();
268
269 hue++;
270
271 // Small delay for animation speed
272 delay(20);
273}
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:118
static const char * HOSTNAME
Definition OTA.ino:106
bool wifi_connected_notified
Definition OTA.ino:230
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 s16x16x4.h:209
@ 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:314

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: