I’m trying to get the IP address of a website on my RP2040 WIO Module. I’m using usocket.getaddrinfo but any website I put in returns (0.0.0.0, 80).
import machine, network, usocket
wlan = network.WLAN_SPI(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, KEY)
if wlan.isconnected():
print(" ip gateway netmask MAC ssid")
print(wlan.ifconfig())
client = usocket.socket()
addr = usocket.getaddrinfo('google.com', 80)[0][-1]
print(addr)
# prints ('0.0.0.0', 80)
I ran this same code on Adafruit RP2040 and it gave me an IP back. Does the usocket library not fully work on the WIO? They have examples in the documentation using this to get an IP address:
I’ve tried on both firmwares: 1.15.3 and 1.15.1
I can also ping my board so it is connected to my wifi.