Devices & Components
Raspberry Pi Pico
USB-A to Micro-USB Cable
Female/Female Jumper Wires
Raspberry Pi Pico W
Software & Tools
Visual Studio 2017
Visual Micro
Arduino IDE
Project description
Code
Raspberry Pi Pico W - WifiScan Example
arduino
Simple Sketch to scan WiFi networks on the Raspberry Pi Pico-W, using the Serial1 interface which runs through the PicoProbe.
1// Simple WiFi network scanner application 2// Released to the public domain in 2022 by Earle F. Philhower, III 3#include <WiFi.h> 4 5void setup() { 6 Serial1.begin(115200); 7} 8 9const char* macToString(uint8_t mac[6]) { 10 static char s[20]; 11 sprintf(s, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 12 return s; 13} 14 15const char* encToString(uint8_t enc) { 16 switch (enc) { 17 case ENC_TYPE_NONE: return "NONE"; 18 case ENC_TYPE_TKIP: return "WPA"; 19 case ENC_TYPE_CCMP: return "WPA2"; 20 case ENC_TYPE_AUTO: return "AUTO"; 21 } 22 return "UNKN"; 23} 24 25void loop() { 26 delay(5000); 27 Serial1.printf("Beginning scan at %d\ 28", millis()); 29 auto cnt = WiFi.scanNetworks(); 30 if (!cnt) { 31 Serial1.printf("No networks found\ 32"); 33 } 34 else { 35 Serial1.printf("Found %d networks\ 36\ 37", cnt); 38 Serial1.printf("%32s %5s %17s %2s %4s\ 39", "SSID", "ENC", "BSSID ", "CH", "RSSI"); 40 for (auto i = 0; i < cnt; i++) { 41 uint8_t bssid[6]; 42 WiFi.BSSID(i, bssid); 43 Serial1.printf("%32s %5s %17s %2d %4d\ 44", WiFi.SSID(i), encToString(WiFi.encryptionType(i)), macToString(bssid), WiFi.channel(i), WiFi.RSSI(i)); 45 } 46 } 47 Serial1.printf("\ 48--- Sleeping ---\ 49\ 50\ 51"); 52 delay(5000); 53} 54
Raspberry Pi Pico W - WifiScan Example
arduino
Simple Sketch to scan WiFi networks on the Raspberry Pi Pico-W, using the Serial1 interface which runs through the PicoProbe.
1// Simple WiFi network scanner application 2// Released to the public domain in 2022 by Earle F. Philhower, III 3#include <WiFi.h> 4 5void setup() { 6 Serial1.begin(115200); 7} 8 9const char* macToString(uint8_t mac[6]) { 10 static char s[20]; 11 sprintf(s, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 12 return s; 13} 14 15const char* encToString(uint8_t enc) { 16 switch (enc) { 17 case ENC_TYPE_NONE: return "NONE"; 18 case ENC_TYPE_TKIP: return "WPA"; 19 case ENC_TYPE_CCMP: return "WPA2"; 20 case ENC_TYPE_AUTO: return "AUTO"; 21 } 22 return "UNKN"; 23} 24 25void loop() { 26 delay(5000); 27 Serial1.printf("Beginning scan at %d\ 28", millis()); 29 auto cnt = WiFi.scanNetworks(); 30 if (!cnt) { 31 Serial1.printf("No networks found\ 32"); 33 } 34 else { 35 Serial1.printf("Found %d networks\ 36\ 37", cnt); 38 Serial1.printf("%32s %5s %17s %2s %4s\ 39", "SSID", "ENC", "BSSID ", "CH", "RSSI"); 40 for (auto i = 0; i < cnt; i++) { 41 uint8_t bssid[6]; 42 WiFi.BSSID(i, bssid); 43 Serial1.printf("%32s %5s %17s %2d %4d\ 44", WiFi.SSID(i), encToString(WiFi.encryptionType(i)), macToString(bssid), WiFi.channel(i), WiFi.RSSI(i)); 45 } 46 } 47 Serial1.printf("\ 48--- Sleeping ---\ 49\ 50\ 51"); 52 delay(5000); 53} 54
Downloadable files
Raspberry Pi Pico W to Pico Probe Wiring Diagram
Shows how to connect the Pico Probe to the Raspberry Pi Pico or Pico-W board for debugging and serial throughput.
Raspberry Pi Pico W to Pico Probe Wiring Diagram

Comments
Only logged in users can leave comments