Added code for Lab 9
This commit is contained in:
parent
4c5757b3cc
commit
5f40f4c866
24 changed files with 796 additions and 0 deletions
17
Lab09/MicroPython/Code/wifi01/wifiScan.py
Normal file
17
Lab09/MicroPython/Code/wifi01/wifiScan.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import network
|
||||
import binascii
|
||||
import rp2
|
||||
rp2.country('us')
|
||||
wlan = network.WLAN() # network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
networks = wlan.scan() # list with tuples (ssid, bssid, channel, RSSI, security, hidden)
|
||||
networks.sort(key=lambda x:x[3],reverse=True) # sorted on RSSI (3)
|
||||
#for i, w in enumerate(networks):
|
||||
# print(i+1, w[0].decode(), binascii.hexlify(w[1]).decode(), w[2], w[3], w[4], w[5])
|
||||
# print('%2d %-30s %16s %4d %4d %4d %4d' %(i+1, w[0].decode(), binascii.hexlify(w[1]).decode(), w[2], w[3], w[4], w[5]))
|
||||
# print(type(i+1), type(w[0].decode()), type(binascii.hexlify(w[1]).decode()), type(w[2]), type(w[3]), type(w[4]), type(w[5]))
|
||||
|
||||
for i, w in enumerate(networks):
|
||||
# print(i+1, w[0].decode(), binascii.hexlify(w[1]).decode(), w[2], w[3], w[4], w[5])
|
||||
print('%2d %-30s %16s %4d %4d %4d %4d' %(i+1, w[0].decode(), binascii.hexlify(w[1]).decode(), w[2], w[3], w[4], w[5]))
|
||||
# print(type(i+1), type(w[0].decode()), type(binascii.hexlify(w[1]).decode()), type(w[2]), type(w[3]), type(w[4]), type(w[5]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue