I have recently purchased a Raspberry PI Pico W and I’m following the example on this link.
I believe I have the latest micro python build and I see this version when Thony starts up. Dated yesterday and it has the W shown. MicroPython v1.19.1-728-g6503cd47a on 2022-12-06; Raspberry Pi Pico W with RP2040
I have filled in my SSID and Password but the execution fails before it event gets to that line with the following error.
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
NameError: name 'network' isn't defined
I’ve tried Googling that error like a good little beginner but nothing useful comes up. To die on line 4 I’m obviously missing something fundamental.
I missed the first few lines when doing the copy and paste
Including the all important “import network”
Maybe google will find this post for the next person
# A simple example that:
# - Connects to a WiFi Network defined by "ssid" and "password"
# - Performs a GET request (loads a webpage)
# - Queries the current time from a server
import network # handles connecting to WiFi
I once googled a very obscure technical problem and got a single hit and that was in Japanese.
Google translated it into English (sort of) and I solved my problem.
If my current project comes together I’ll try and do an article of how it works.
And you can get our latest projects and tips straight away by following us on: