openmv/scripts/examples/10-Arduino-Boards/Nicla-Vision/03-WiFi/connect.py
iabdalkader 11194954cb examples: Update all networking scripts.
* Remove non-standard timeout arg and use isconnected.
2023-06-28 17:16:27 +02:00

21 lines
484 B
Python

# Connect Example
#
# This example shows how to connect your OpenMV Cam with a WiFi shield to the net.
import network
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())