Wlan.scan()

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
giants
Posts: 44
Joined: Fri Apr 26, 2019 2:07 pm

Wlan.scan()

Post by giants » Tue Mar 31, 2020 9:39 pm

Hi there!
When i use wlan.scan() for check the wireless networks i receve back a string with all’ networks, my problem is how i can exstrapolate the data ?

Thank you
Sergio

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Wlan.scan()

Post by jimmo » Tue Mar 31, 2020 10:58 pm

Hi,

Sorry I'm not sure what you mean by "extrapolate the data".

scan returns a list of tuples. Each tuple is (according to the docs) (ssid, bssid, channel, RSSI, authmode, hidden).

So for example, you can use Python's tuple unpacking:

Code: Select all

x = sta_if.scan()
for result in x:
  ssid, bssid, channel, RSSI, authmode, hidden = x
  print(ssid)

giants
Posts: 44
Joined: Fri Apr 26, 2019 2:07 pm

Re: Wlan.scan()

Post by giants » Wed Apr 01, 2020 9:05 am

Hi
yes that is what i mean thank you soo much. Your code gave me one error but i sobstitute result with x and now wok

Have a wonderful day
Sergio

Post Reply