In this lesson, we will create a project to turn your PICO W into a Wifi Signal Strength Scanner. To begin, connect your Raspberry Pi Pico to either:
To connect your Raspberry Pi Pico W to your computer, follow these steps:
Note: If you want to connect your Pico in USB mass storage device mode (so you can copy files to it), hold down the BOOTSEL button as you are connecting the USB to your computer.
To connect your Raspberry Pi Pico W to your iPad, follow these steps:
Depending on the device you are using, you will need to use a different editor:
Depending on the device you are using, you will need to use a different editor:
If you are using a PC or laptop, open your web browser and go to code.circuitpython.org
If you are using an iPad, download and install the Koder app from the App Store.
If you are using the CircuitPython editor (code.circuitpython.org) then we need to connect the editor to your PICO W so that we can transfer code to it.
You can skip this step if you're using an iPad.
To connect your editor (at code.circuitpython.org) to your PICO W follow these steps:
Your editor should now be connected to your PICO W and ready to code.
Create a new file in your chosen editor and with the name 'code.py'.
In your CircuitPython editor (code.circuitpython.org):
Note: the CircuitPython editor starts with a new file open and ready to go, so you might not need to do this.
On your Koder app:
In this step, you will import the necessary libraries for your project. A library is a collection of pre-written code that you can use to perform specific tasks. By importing libraries, you can save time and effort, as you don't have to write the code from scratch.
Add the following code to your project:
import network
import socket
from time import sleep
Here's what each library does:
network
: This library allows you to connect your Raspberry Pi Pico to Wi-Fi networks and perform network-related tasks, such as scanning for available networks.socket
: This library enables you to create and manage network sockets, which are essential for establishing connections and exchanging data between devices over a network.time > sleep
: This library provides the sleep function, which allows you to pause the execution of your program for a specified amount of time. This can be useful for controlling the timing of certain operations, such as waiting for a network connection to be established.