本文整理汇总了Python中network.WLAN.irq方法的典型用法代码示例。如果您正苦于以下问题:Python WLAN.irq方法的具体用法?Python WLAN.irq怎么用?Python WLAN.irq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network.WLAN
的用法示例。
在下文中一共展示了WLAN.irq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wlan_connect
# 需要导入模块: from network import WLAN [as 别名]
# 或者: from network.WLAN import irq [as 别名]
def wlan_connect():
wifi = WLAN(mode=WLAN.STA)
wifi.ifconfig(config=(__myip, __netmask, __gateway, __dns))
wifi.scan() # scan for available networks
wifi.connect(ssid=__ssid, auth=(WLAN.WPA2, __nwpass))
while not wifi.isconnected():
pass
syslog('WiPy is up and running')
wifi.irq(trigger=WLAN.ANY_EVENT, wake=machine.SLEEP)
machine.sleep()
示例2: print
# 需要导入模块: from network import WLAN [as 别名]
# 或者: from network.WLAN import irq [as 别名]
if not wlan.isconnected():
print('Attempting to connect to WiFi', end=' ')
nets = wlan.scan()
for net in nets:
if net.ssid == 'Robotmad':
KEY = 'mou3se43'
break
elif net.ssid == 'CoderDojo':
KEY = 'coderdojo'
break
if KEY != '':
print(net.ssid, end=" ")
wlan.connect(net.ssid, auth=(net.sec, KEY), timeout=10000)
if wlan.isconnected():
print('Connected')
tim_a.freq(10)
wlan.irq(trigger=WLAN.ANY_EVENT, wake=machine.SLEEP)
else :
wlan.init(WLAN.AP, ssid='wipy-wlan', auth=(WLAN.WPA2, 'www.wipy.io'), channel=5, antenna=WLAN.INT_ANT)
print('Failed - setting up as AP wipy-wlan')
tim.deinit() # Cancel timer that was flashing the LED
led_out(True) # True = LED Off
#print(wlan.ifconfig())
print('Done.')
#machine.sleep()