-
Notifications
You must be signed in to change notification settings - Fork 34
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
When using Raspberry Pi Pico W, there's no simple way to connect to WiFi networks using picozero. Users have to work directly with the network module, which requires understanding lower-level concepts and boilerplate code. This goes against picozero's philosophy of making hardware interaction simple and beginner-friendly.
Solution
Add a WiFi class to picozero that provides simple WiFi connectivity for Pico W and related methods:
`from picozero import WiFi
wifi = WiFi()
wifi.connect("NetworkName", "password")
print(wifi.ip)
print(wifi.signal_strength)`
Features:
- Connect to WiFi network with configurable timeout
- Check connection status with is_connected property
- Access network information: ip, subnet, gateway, dns, ssid
- Get signal strength in dBm
- info() method returning dictionary of all connection details
- disconnect() method to cleanly disconnect
- Helpful error messages when connection fails
- Graceful error on regular Pico (not Pico W)
Other features considered
- Auto-reconnect functionality: Decided against this as it adds background processes and callbacks, making it too complex for a 'zero' library. Users can explicitly check is_connected and reconnect when needed.
- Convenience wrapper function: Decided against connect_wifi() function to maintain consistency with the rest of the library which uses classes directly.
- Network scanning: Not including SSID scanning as it's an advanced feature rarely needed by beginners.
Additional context
Design follows picozero's philosophy:
- Simple, explicit API
- No hidden background processes
- Consistent with other picozero classes
- Educational examples showing common patterns (basic connection, getting info, handling reconnection)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request