Skip to content

Commit a91941e

Browse files
authored
Merge pull request #2740 from adafruit/itsybitsy_factory
adding itsybitsy esp32 factory test
2 parents 082126a + 351884b commit a91941e

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Factory_Tests/ItsyBitsy_ESP32_FactoryReset/.feather_esp32_v2.test.only

Whitespace-only changes.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-FileCopyrightText: 2024 ladyada for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#include "WiFi.h"
6+
#include <Adafruit_TestBed.h>
7+
extern Adafruit_TestBed TB;
8+
9+
void setup() {
10+
Serial.begin(115200);
11+
Serial.println("ItsyBitsy ESP32 Factory Reset");
12+
13+
TB.neopixelPin = PIN_NEOPIXEL;
14+
TB.neopixelNum = 1;
15+
TB.begin();
16+
TB.setColor(0x0);
17+
}
18+
19+
uint8_t j = 0;
20+
void loop() {
21+
pinMode(13, OUTPUT);
22+
if (j == 255) {
23+
TB.setColor(GREEN);
24+
Serial.println("scan start");
25+
// WiFi.scanNetworks will return the number of networks found
26+
int n = WiFi.scanNetworks();
27+
Serial.println("scan done");
28+
if (n == 0) {
29+
Serial.println("no networks found");
30+
} else {
31+
Serial.print(n);
32+
Serial.println(" networks found");
33+
for (int i = 0; i < n; ++i) {
34+
// Print SSID and RSSI for each network found
35+
Serial.print(i + 1);
36+
Serial.print(": ");
37+
Serial.print(WiFi.SSID(i));
38+
Serial.print(" (");
39+
Serial.print(WiFi.RSSI(i));
40+
Serial.print(")");
41+
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
42+
delay(10);
43+
}
44+
}
45+
Serial.println("");
46+
}
47+
48+
TB.setColor(TB.Wheel(j++));
49+
delay(10);
50+
if (j % 20 == 10) digitalWrite(13, HIGH);
51+
if (j % 20 == 0) digitalWrite(13, LOW);
52+
return;
53+
54+
}

0 commit comments

Comments
 (0)