本文整理汇总了Python中network.WLAN.mac方法的典型用法代码示例。如果您正苦于以下问题:Python WLAN.mac方法的具体用法?Python WLAN.mac怎么用?Python WLAN.mac使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network.WLAN
的用法示例。
在下文中一共展示了WLAN.mac方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from network import WLAN [as 别名]
# 或者: from network.WLAN import mac [as 别名]
print(wifi.isconnected() == True)
wifi.disconnect()
print(wifi.isconnected() == False)
t0 = time.ticks_ms()
wifi.connect(testconfig.wlan_ssid, auth=testconfig.wlan_auth, timeout=0)
print(time.ticks_ms() - t0 < 500)
wifi.disconnect()
print(wifi.isconnected() == False)
# test init again
wifi.init(WLAN.AP, ssid='www.wipy.io', auth=None, channel=5, antenna=WLAN.INT_ANT)
print(len(wifi.mac()) == 6)
# next ones MUST raise
try:
wifi.init(mode=12345)
except:
print('Exception')
try:
wifi.init(1, mode=WLAN.AP)
except:
print('Exception')
try:
wifi.init(mode=WLAN.AP, ssid=None)
except:
示例2: Exception
# 需要导入模块: from network import WLAN [as 别名]
# 或者: from network.WLAN import mac [as 别名]
'''
import machine
import os
from network import WLAN
mch = os.uname().machine
if not 'LaunchPad' in mch and not'WiPy' in mch:
raise Exception('Board not supported!')
wifi = WLAN()
print(machine)
machine.idle()
print(machine.freq() == (80000000,))
print(machine.unique_id() == wifi.mac())
machine.main('main.py')
rand_nums = []
for i in range(0, 100):
rand = machine.rng()
if rand not in rand_nums:
rand_nums.append(rand)
else:
print('RNG number repeated')
break
for i in range(0, 10):
machine.idle()