import network from machine import Pin from config import * from time import sleep import ubinascii def do_connect(): led = Pin(8, Pin.OUT) sta_if = network.WLAN(network.STA_IF) sta_if.ifconfig((ip, '255.255.255.0', gateway, '1.1.1.1')) if not sta_if.isconnected(): print('connecting to network...') sta_if.active(True) sta_if.connect(ssid, password) led.on() for i in range(10): if sta_if.isconnected(): print('network config:', sta_if.ifconfig()) led.off() break sleep(1) do_connect() def ap(password): ap_if = network.WLAN(network.AP_IF) ap_if.active(True) ap_mac = ap_if.config('mac') ssid = f"led-{ubinascii.hexlify(ap_mac).decode()}" print(ssid) ap_if.config(essid=ssid, password="qwerty1234") print(ap_if.ifconfig())