Hi, I have been trying to get my ESP 32 to connect to my local network using micropython. I found a lot of documentation online with sample code. All the examples use the following attached below. If the SSID or password is wrong, won't the while loop be stuck indefinitely? I see all examples with this implementation. How do I change the code so that the connection process stops after it gets a password incorrect error?
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)
while station.isconnected() == False:
pass
WiFi connection Question
Re: WiFi connection Question
You can use the status() method to find out whether the connection succeeded or not.Ajaykrishna123 wrote: ↑Tue Apr 28, 2020 7:54 pmHow do I change the code so that the connection process stops after it gets a password incorrect error?
Please also see viewtopic.php?f=18&t=7942 -- there's a bug where you won't always see the reason for failure, but you will see that it did fail.
-
- Posts: 1
- Joined: Thu May 21, 2020 3:00 am
- Contact:
Re: WiFi connection Question
Thanks for your answer. It helped me a lot.jimmo wrote: ↑Tue Apr 28, 2020 11:45 pmYou can use the status() method to find out whether the connection succeeded or not.Ajaykrishna123 wrote: ↑Tue Apr 28, 2020 7:54 pmHow do I change the code so that the connection process stops after it gets a password incorrect error?
Please also see viewtopic.php?f=18&t=7942 -- there's a bug where you won't always see the reason for failure, but you will see that it did fail.