Feb-28-2023, 06:32 PM
(Feb-28-2023, 06:27 PM)rob101 Wrote: Not that I've used the libraries that you are using, but wouldwhile not station.scan():
be better? That way (in theory, least ways) you're testing for 'truthfulness'. Also, do you not have to updatestation.scan()
in thewhile:
loop? If not, how will any change in state be detected?
I now have this code
# wifi_test.py import network import time # Create a station object to store our connection wifi = network.WLAN(network.STA_IF) wifi.active(True) available_wifi_networks = wifi.scan() while len(available_wifi_networks) == 0: print("Waiting for wifi.scan() to return something...") time.sleep(1) available_wifi_networks = wifi.scan() else: for i in available_wifi_networks: print (i)It just keeps outputting
Output:Waiting for wifi.scan() to return something...