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