Skip to content

Commit e685547

Browse files
authored
Merge pull request #2169 from ladyada/main
qt py esp32 selftest
2 parents a83b05a + 1dc8817 commit e685547

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

Factory_Tests/QTPy_ESP32_FactoryTest/.qtpy_esp32.test.only

Whitespace-only changes.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#include <Arduino.h>
6+
#include <Adafruit_NeoPixel.h>
7+
#include "Adafruit_TestBed.h"
8+
#include <WiFi.h>
9+
#include <WiFiAP.h>
10+
#include <esp_wifi.h>
11+
12+
extern Adafruit_TestBed TB;
13+
14+
IPAddress myIP;
15+
16+
17+
void setup() {
18+
Serial.begin(115200);
19+
//while (! Serial) delay(10);
20+
21+
delay(100);
22+
Serial.println("QT Py ESP32 Pico factory test!");
23+
24+
Serial.printf("Total heap: %d\n", ESP.getHeapSize());
25+
Serial.printf("Free heap: %d\n", ESP.getFreeHeap());
26+
Serial.printf("Total PSRAM: %d\n", ESP.getPsramSize());
27+
Serial.printf("Free PSRAM: %d\n", ESP.getFreePsram());
28+
29+
pinMode(NEOPIXEL_POWER, OUTPUT);
30+
digitalWrite(NEOPIXEL_POWER, HIGH);
31+
32+
TB.neopixelPin = PIN_NEOPIXEL;
33+
TB.neopixelNum = 1;
34+
TB.begin();
35+
TB.setColor(0x0);
36+
}
37+
38+
uint8_t j = 0;
39+
40+
void loop() {
41+
if (j == 255) {
42+
TB.setColor(GREEN);
43+
Serial.println("scan start");
44+
// WiFi.scanNetworks will return the number of networks found
45+
int n = WiFi.scanNetworks();
46+
Serial.println("scan done");
47+
if (n == 0) {
48+
Serial.println("no networks found");
49+
} else {
50+
Serial.print(n);
51+
Serial.println(" networks found");
52+
for (int i = 0; i < n; ++i) {
53+
// Print SSID and RSSI for each network found
54+
Serial.print(i + 1);
55+
Serial.print(": ");
56+
Serial.print(WiFi.SSID(i));
57+
Serial.print(" (");
58+
Serial.print(WiFi.RSSI(i));
59+
Serial.print(")");
60+
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
61+
delay(10);
62+
}
63+
}
64+
Serial.println("");
65+
}
66+
67+
TB.setColor(TB.Wheel(j++));
68+
delay(10);
69+
}

0 commit comments

Comments
 (0)