Wifi not working properly in Pico W. #13369
Unanswered
Aman2210200
asked this question in
RP2040 / Pico
Replies: 1 comment 1 reply
-
Please use code formatting |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Enthusiasts, I am building a project on pico w and smashed with this problem of Wifi in pico w.
Let's suppose my pico w is connected to a wifi , it has the ssid & psk of the wifi. while pico w being connected to the wifi , if i change the psk of the wifi & reboot it then still pico w shows that it is connected to the same wifi but it does not have the new psk.
I did some trouble shooting & found it disconnects with the internet but its wlan.status does not changes and wlan.isconnected stays true.
this is the code i used :-
import network
import utime
SSID = "XXXX"
PSK = "XXXXX"
wlan =0
def connect_to_wifi(ssid, psk):
global wlan
Enable WiFi in Client Mode
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
Connect to WiFi, keep trying until failure or success
wlan.connect(ssid, psk)
for i in range(5):
while wlan.isconnected() == False:
wlan.connect(ssid, psk)
print(wlan.status())
print("Waiting to Connect")
utime.sleep(5)
if wlan.isconnected():
print("Connected to WiFi")
raise Exception("WiFi not available")
connect_to_wifi(SSID,PSK)
while True:
print(wlan)
if wlan.isconnected():
print(wlan.status())
print("Connected to WiFi")
utime.sleep(1)
else:
print("Wifi not available")
Can anyone help me in this , i dont know why this is happening , i tried changing the module , changing the wifi but nothing works.
But when i change the ssid instead of psk then it gets disconnected instantly.
Beta Was this translation helpful? Give feedback.
All reactions