File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Factory_Tests/ItsyBitsy_ESP32_FactoryReset Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments