OTA.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pycom-libraries 作者: pycom 项目源码 文件源码
def connect(self):
        self.wlan = network.WLAN(mode=network.WLAN.STA)
        if not self.wlan.isconnected() or self.ssid() != self.SSID:
            for net in self.wlan.scan():
                if net.ssid == self.SSID:
                    self.wlan.connect(self.SSID, auth=(network.WLAN.WPA2,
                                                       self.password))
                    while not self.wlan.isconnected():
                        machine.idle()  # save power while waiting
                    break
            else:
                raise Exception("Cannot find network '{}'".format(SSID))
        else:
            # Already connected to the correct WiFi
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号