while not wlan.isconnected(): - Infinite Loop
-
Hi Team,
After the latest update(sysname='LoPy', nodename='LoPy', release='1.5.0.b2', version='v1.8.6-412-gf55ba50 on 2017-01-28', machine='LoPy with ESP32')
The below code is entering into an infinite Loop.Is wlan isConnected not working ?
from network import WLAN from time import sleep_ms wifi_count=1 while not wlan.isconnected(): print('Connecting Wifi attempt-{}'.format(wifi_count)) wlan.connect('XXXX-NetGear', auth=(WLAN.WPA2, 'booboo@123'), timeout=5000) sleep_ms(1000) wifi_count=wifi_count+1 passThanks & regards,
MK HB -
Hi Guys,
If we increase sleep_ms to 5 secs then it works ? Is that the proper way to do this ?Thanks & regards,
MK HB -
no it is not good
look here for example:
https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/wlan.htmlwhile not wlan.isconnected(): machine.idle() # save power while waitingand questions:
- your router have dhcp enabled?
if not then try setting fixed ip in your LoPY
e.g.
wlan.ifconfig(config=('192.168.1.120', '255.255.255.0', '192.168.1.1', '192.168.1.1'))- Do you have MAC filtering in your router enabled?
if yes you must add mac of your LoPy
- your router have dhcp enabled?
-
@livius Thanks a lot :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login