Arduino Quick Start
Air Quality Wi-Fi related APIs and example program.
#include <M5Unified.h>
#include <WiFi.h>
void setup() {
// Initialize M5Unified
M5.begin();
// Clear screen once – black background
M5.Lcd.fillScreen(TFT_BLACK);
// Set text properties
M5.Lcd.setTextSize(1);
M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK);
// Scan for Wi-Fi networks
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
int n = WiFi.scanNetworks();
// Print results to the screen
M5.Lcd.setCursor(0, 0);
M5.Lcd.printf("Found %d networks\n\n", n);
for (int i = 0; i < n; i++) {
// Long SSIDs will wrap automatically
M5.Lcd.printf("%2d: %s\n (%d dBm)\n\n",
i + 1,
WiFi.SSID(i).c_str(),
WiFi.RSSI(i));
delay(50);
}
}
void loop() {
M5.update();
// To refresh periodically, place code here
}
After uploading, press the reset button to see the following: