Wifi setup function with initial wlan config and per-board unique ssid
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m31s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m31s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
This commit is contained in:
@@ -5,6 +5,7 @@ import aiorepl
|
|||||||
import asyncio
|
import asyncio
|
||||||
import machine
|
import machine
|
||||||
import micropython
|
import micropython
|
||||||
|
import network
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from machine import Pin
|
from machine import Pin
|
||||||
@@ -78,6 +79,13 @@ class SDContext:
|
|||||||
self.sdcard.deinit()
|
self.sdcard.deinit()
|
||||||
|
|
||||||
|
|
||||||
|
def setup_wifi():
|
||||||
|
network.hostname("TonberryPico")
|
||||||
|
wlan = network.WLAN(network.WLAN.IF_AP)
|
||||||
|
wlan.config(ssid=f"TonberryPicoAP_{machine.unique_id().hex()}", security=wlan.SEC_OPEN)
|
||||||
|
wlan.active(True)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
asyncio.new_event_loop()
|
asyncio.new_event_loop()
|
||||||
# Setup LEDs
|
# Setup LEDs
|
||||||
@@ -85,6 +93,9 @@ def run():
|
|||||||
np = NeoPixel(pin, 10, sm=1)
|
np = NeoPixel(pin, 10, sm=1)
|
||||||
asyncio.create_task(rainbow(np))
|
asyncio.create_task(rainbow(np))
|
||||||
|
|
||||||
|
# Wifi with default config
|
||||||
|
setup_wifi()
|
||||||
|
|
||||||
# Setup MP3 player
|
# Setup MP3 player
|
||||||
with SDContext(mosi=Pin(3), miso=Pin(4), sck=Pin(2), ss=Pin(5), baudrate=15000000), \
|
with SDContext(mosi=Pin(3), miso=Pin(4), sck=Pin(2), ss=Pin(5), baudrate=15000000), \
|
||||||
AudioContext(Pin(8), Pin(6)) as audioctx:
|
AudioContext(Pin(8), Pin(6)) as audioctx:
|
||||||
|
|||||||
Reference in New Issue
Block a user