From 815e3b175f32dc6dcbe83e6b2359883e67b1fbaa Mon Sep 17 00:00:00 2001 From: sickprodigy Date: Mon, 3 Nov 2025 19:52:23 -0500 Subject: [PATCH] fix wifi issue, also want flashing light while wifi is connected. Fixed it. --- main.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 271d412..61c0d85 100644 --- a/main.py +++ b/main.py @@ -4,13 +4,10 @@ import network import urequests as requests from secrets import secrets -# Initialize pins -contactorLights = Pin(18, Pin.OUT) +# Initialize pins (LED light onboard) led = Pin("LED", Pin.OUT) - # Initial state led.low() -contactorLights.low() # Network connection def connect_wifi(): @@ -45,10 +42,18 @@ wifi = connect_wifi() # Connection monitoring loop while True: if not wifi or not wifi.isconnected(): + # Fast blink when disconnected led.on() - time.sleep(0.5) + time.sleep(0.2) led.off() - time.sleep(0.5) + time.sleep(0.2) # Try to reconnect wifi = connect_wifi() - time.sleep(1) \ No newline at end of file + else: + # Slow blink when connected + led.on() + time.sleep(1) + led.off() + time.sleep(1) + + time.sleep(0.1) \ No newline at end of file