3000 TL ve üzeri siparişlerde Kargo Ücretsiz!
Getting Wi-Fi MAC Address on NodeMCU and ESP32

Getting Wi-Fi MAC Address on NodeMCU and ESP32

Learn how to read the Wi-Fi MAC address of NodeMCU and ESP32 boards from the Serial monitor. The MAC address identifies the device network hardware.

2 min read 3052 views

This article shows how to read the Wi-Fi MAC address of NodeMCU and ESP32 boards from the Serial monitor. The MAC address identifies the device network hardware and is required for applications such as ESP-NOW.

What is MAC?

MAC (Media Access Control) identifies the hardware address of devices on a network. Just like a vehicle license plate, each device has its own unique MAC address and this address prevents confusion. According to Wikipedia, a MAC address is used to identify the network hardware of a device on a computer network. Since it is a 48-bit address, it can be used to identify 2⁴⁸ = 281,474,976,710,656 different network cards.

Finding the MAC Address

NodeMCU and ESP32 boards can connect to the internet, so each has its own unique MAC address. The code below prints this address to the Serial monitor.

Code

/* ****** ESP modüllerinin MAC adresi öğrenme ********

 MAC adresi öğrenme programı:
 • Bu program ESP-NOW özelliklerini kullanmak için
 MAC adresinin öğrenilmesi gerekliliğinden ortaya çıkmıştır.
 • Cihazların MAC adresleri Serial monitöre yansıtılacak,
 her bir cihazın MAC adresi farklıdır ve bu yüzden
 her cihazın MAC adresini not almanız önerilir.

 by Ali Birkan BAYRAM
*/

//━━━━━━━━━ Nodemcu için gerekli kütüphaneler ━━━━━━━━━━━━━━
#ifdef ESP32 // Eğer mikrodenetleyicimiz ESP32 ise
 #include <WiFi.h>
#else // Eğer mikrodenetleyicimiz ESP8266 ise
 #include <ESP8266WiFi.h>
#endif

//━━━ void setup() fonksiyonu ile kurulum yapılıyor ━━━━━━
void setup() {
 Serial.begin(115200); // Serial ekran hızı: 115200 baud
 Serial.println(); // Serial ekranını yukarıdaki hıza ayarla.
 Serial.print("ESP modülünün MAC adresi: ");
 Serial.println(WiFi.macAddress());
 delay(3000); // 3 saniyelik bir gecikme ekliyoruz bilerek
 Serial.println("MAC adresinizi öğrenmek istiyorsanız lütfen \"m\" veya \"M\" tuşuna basınız.");
 // Serial ekranına Wi-Fi MAC adresiniz çıktı, lütfen bir
 // köşeye not alın, daha sonra lazım olacaktır.
}

// Herhangi bir şekilde void loop fonksiyonunun dolu olma
// zorunluluğu yoktur. Bu yüzden boş olarak bıraktık.
void loop() {
 if (Serial.available()) { // Kullanıcı seri bilgi gönderdiğinde çalışır.
 char temp = Serial.read(); // temp değişkenine gelen bilgiyi yaz
 if (temp == 'm' || temp == 'M') { // Eğer m veya M gönderilmişse MAC adresini göster.
 Serial.print("ESP modülünün MAC adresi: ");
 Serial.println(WiFi.macAddress());
 }
 Serial.println("MAC adresinizi öğrenmek istiyorsanız lütfen \"m\" veya \"M\" tuşuna basınız.");
 delay(1000);
 }
}
Share
Back to all posts

Yorumlar

No comments yet. Be the first to write one.

Your email is not published. Comments are reviewed before publishing.

This form is protected by Google reCAPTCHA; the Google Privacy Policy and Terms of Service apply.

Benzer Yazılar

Read More
Hızlı Kargo Hafta içi saat 15:00 öncesinde oluşturduğunuz tüm siparişler aynı gün kargoya verilmektedir.
Güvenli Alışveriş Tüm bilgileriniz 256 Bit SSL sertifikasıyla korunmaktadır.
Uzman Teknik Servis Ürünleriniz için profesyonel bakım ve onarım.
Ücretsiz Kargo Belirli tutarın üzerindeki alışverişlerinizde kargo ücreti ödemezsiniz.

Bültenimize Abone Ol

Kampanya ve fırsatlardan ilk siz haberdar olun.

Kuruköprü Mah. Sefa Özler Cad. özden İşmerkezi kat 7/74 Seyhan / adana

Ödeme Yöntemleri

Visa Mastercard Banka Kartı World

©2017 - 2026 All rights reserved.