mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
26 lines
634 B
Python
26 lines
634 B
Python
# This work is licensed under the MIT license.
|
|
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
|
|
# https://github.com/openmv/openmv/blob/master/LICENSE
|
|
#
|
|
# Connect Example
|
|
#
|
|
# This example shows how to connect to a WiFi network.
|
|
|
|
import network
|
|
import time
|
|
|
|
SSID = "" # Network SSID
|
|
KEY = "" # Network key
|
|
|
|
# Init wlan module and connect to network
|
|
wlan = network.WLAN(network.STA_IF)
|
|
wlan.active(True)
|
|
wlan.connect(SSID, KEY)
|
|
|
|
while not wlan.isconnected():
|
|
print('Trying to connect to "{:s}"...'.format(SSID))
|
|
time.sleep_ms(1000)
|
|
|
|
# We should have a valid IP now via DHCP
|
|
print("WiFi Connected ", wlan.ifconfig())
|