Presto wifi

I got my PRESTO working like this:

# Test WIFI network connection
# Tony Goodhew 27 Dec 2024
import time
import network
import rp2
import requests
rp2.country("GB")
from secrets import WIFI_SSID, WIFI_PASSWORD

wlan = network.WLAN(network.STA_IF)
wlan.active(True)

wlan.connect(WIFI_SSID, WIFI_PASSWORD)
max_wait = 30
while max_wait > 0:
    if wlan.status() < 0 or wlan.status() >= 3:
        break
    max_wait -= 1
    print("Waiting for Wi-Fi connection...")
    time.sleep(1)

if wlan.status() != 3:
    raise RuntimeError("Network connection failed")
else:
    print("Connected to Wi-Fi network.")
    print(wlan.ifconfig())

#response = requests.get("https://text.npr.org/")
#response = requests.get("http://wttr.in/cambridge?format=3")
#response = requests.get("http://ipecho.net/plain")
response = requests.get("https://earthquake.usgs.gov/fdsnws/event/1/query?format=text&limit=10")
#response = requests.get("http://artscene.textfiles.com/asciiart/unicorn")
for x in response.content.splitlines():
    xs = str(x)
    print(str(xs))
response.close()

Basically the Pico2 W uf2 appears to be under all Phil’s super bits and bobs add-ons. I’ve not had time to process data from the web and output it to the big screen yet.