The Raspberry Pi Foundation changed single-board computing when they released the Raspberry Pi computer, now they’re ready to do the same for microcontrollers with the release of the brand new Raspberry Pi Pico W. This low-cost microcontroller board features their powerful new chip, the RP2040, and all the fixin’s to get started with IoT embedded electronics projects at a stress-free price.
Raspberry Pi Pico W brings WiFi to the Pico platform while retaining complete pin compatibility with its older sibling, and now as of CircuitPython 8.0.0-beta.2, there is CircuitPython WiFi support for the Pico W! This guide includes examples for testing your WiFi connection, using requests to pull JSON feeds, ping API’s and log sensor data for IoT projects; all using CircuitPython!
If you have an error while running your code, the status bar will tell you what line of code was running when the error occurred, as well as the type of error.
Additionally, if you end the program from the shell with a
KeyboardInterrupt, that information will be displayed in the status bar.
WiFi and networking are complicated and have many failure states. Rather than having extensive code to detect and recover from each specific kind of failure, the examples here use
microcontroller.reset() which fully re-initialize both the microcontroller and the WiFi co-processor and start the code again with a clean slate.
The general pattern is:
try: your_application_here() except Exception as e: print("Error:\n", str(e)) print("Resetting microcontroller in 10 seconds") time.sleep(10) microcontroller.reset()