Unverified Commit 034d568d authored by Lucas Saavedra Vaz's avatar Lucas Saavedra Vaz Committed by GitHub

ci(wifi): Add scan to wifi test (#9805)

parent 29286540
def test_wifi(dut): def test_wifi(dut):
dut.expect_exact("Scan start")
dut.expect_exact("Scan done")
dut.expect_exact("Wokwi-GUEST")
dut.expect_exact("WiFi connected") dut.expect_exact("WiFi connected")
dut.expect_exact("IP address:") dut.expect_exact("IP address:")
...@@ -112,6 +112,28 @@ void setup() { ...@@ -112,6 +112,28 @@ void setup() {
Serial.println(eventID); Serial.println(eventID);
// WiFi.removeEvent(eventID); // WiFi.removeEvent(eventID);
Serial.println("Scan start");
// WiFi.scanNetworks will return the number of networks found.
int n = WiFi.scanNetworks();
Serial.println("Scan done");
if (n == 0) {
Serial.println("no networks found");
} else {
Serial.print(n);
Serial.println(" networks found");
for (int i = 0; i < n; ++i) {
// Print SSID for each network found
Serial.printf("%s\n", WiFi.SSID(i).c_str());
Serial.println();
delay(10);
}
}
Serial.println("");
// Delete the scan result to free memory for code below.
WiFi.scanDelete();
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
Serial.println(); Serial.println();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment