參考資訊:
https://docs.arduino.cc/tutorials/nano-esp32/esp-now/
https://randomnerdtutorials.com/get-change-esp32-esp8266-mac-address-arduino/
#include <WiFi.h>
#include <esp_wifi.h>
void setup() {
uint8_t buf[6] = { 0 };
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.STA.begin();
Serial.print("MAC Address: ");
if (esp_wifi_get_mac(WIFI_IF_STA, buf) == ESP_OK) {
Serial.printf("%02x:%02x:%02x:%02x:%02x:%02x\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
}
else {
Serial.println("Failed to read MAC address");
}
}
void loop() {
}