ws281x/boot.py

28 lines
613 B
Python
Raw Permalink Normal View History

2024-09-14 08:57:28 +00:00
import network
from machine import Pin
from config import *
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()
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
do_connect()
ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid="led", password="qwerty1234")
print(ap.ifconfig())