Mac Address ESP32 / ESP8266

วิธีหา Mac Address ของ ESP32 หรือ ESP8266

ตัวอย่างนี้คือของ ESP8266
ถ้าเป็น ESP32 ก็แค่เปลี่ยน include file เป็น WiFi.h ก็พอ

#include <ESP8266WiFi.h>

void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  Serial.println("\n\n");
  Serial.print("MAC ADDRESS: ");
  Serial.print(WiFi.macAddress());
}

void loop() {
  // put your main code here, to run repeatedly:

}