Arduino Quick Start
DinMeter Wi‑Fi related API and example program。
#include <M5Unified.h>
#include <WiFi.h>
void setup() {
// Initialize M5Unified
auto cfg = M5.config();
M5.begin(cfg);
M5.Display.fillScreen(TFT_BLACK);
// Set text properties
M5.Display.setTextSize(1);
M5.Display.setTextColor(TFT_WHITE, TFT_BLACK);
// Scan Wi‑Fi
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
int n = WiFi.scanNetworks();
// Print results on the DinMeter screen
M5.Display.setCursor(0, 0);
M5.Display.printf("Found %d networks\n\n", n);
for (int i = 0; i < n; i++) {
M5.Display.printf("%2d: %s\n (%d dBm)\n\n",
i + 1,
WiFi.SSID(i).c_str(),
WiFi.RSSI(i));
delay(50);
}
}
void loop() {
M5.update();
// Place periodic refresh here if needed
}
After uploading, press the Reset button to see the following effect: