add
This commit is contained in:
22
ESP-codes/MicroPython/ssid_connect.py
Normal file
22
ESP-codes/MicroPython/ssid_connect.py
Normal file
@@ -0,0 +1,22 @@
|
||||
ssid = "PT4ObjConnect" # wifi router name
|
||||
pw = "Admin2022" # wifi router password
|
||||
|
||||
def do_connect():
|
||||
import network
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
if not sta_if.isconnected():
|
||||
print('connecting to network...')
|
||||
sta_if.active(True)
|
||||
sta_if.connect(ssid, pw)
|
||||
while not sta_if.isconnected():
|
||||
pass
|
||||
print('network config:', sta_if.ifconfig())
|
||||
|
||||
def configure_AP():
|
||||
import network
|
||||
ap = network.WLAN(network.AP_IF)
|
||||
ap.active(True)
|
||||
ap.config(essid='MP115', password='MP115')
|
||||
|
||||
do_connect()
|
||||
#configure_AP()
|
||||
Reference in New Issue
Block a user