Part 1 - Scan for Available Networks
The code below shows you how to scan for available networks using your Pi Pico W’s inbuilt WiFi module.
-
Connect your Pi Pico W to your computer.
-
Copy the example code below and use
Mu Editor
to save it to yourcode.py
file. Remember to back up your old code elsewhere. -
Open the
Serial Monitor
to verify that your microcontroller can find a network to connect to in the next step.import wifi import time while True: print("\nAvailable Networks:") print([network.ssid for network in wifi.radio.start_scanning_networks()]) wifi.radio.stop_scanning_networks() time.sleep(10)
Starting with this tutorial, code examples will include so-called comments. Comments exist to document the code and are ignored by the program. They are meant to help you and others understand the code better. In CircuitPython, comments begin with the #
character.