Hello everyone,
I am struggling to obtain ESP8266 and ESP32 mac address.
There are multiple ways to obtain it:
WiFi.macAddress()
esp_read_mac() //for which you need to specify an interface
- ...
esp_efuse_mac_get_default() seems to get the factory assigned mac address of the chip.
I can't make esp_... functions work in Arduino IDE. I can't include esp_system.h neither.
How to make those work in Arduino IDE?
Thank you for your help,
Have a good day!
gfvalvo
2
Why don't you want to use WiFi.macAddress()?
It gives a different result if I call it very early in setup() vs later on in loop()
gfvalvo
4
Please post the code that behaves that way. I'd like to try it on an ESP32
I don't have the code that produced 2 different mac adresses anymore. I tried to rewrite it, but now it gives me only one mac address...
gfvalvo
6
Pilot Error 
Anyway, I found the API you asked about. Compiles but untested:
#include "esp_mac.h"
void setup() {
uint8_t mac[8];
esp_efuse_mac_get_default(mac);
}
void loop() {
}
What do I need to install to be able to use esp_mac.h ?
might be obvious, but i quite don't understand what download from esp-idf-2.0/components/esp32/include/esp_system.h at master · pycom/esp-idf-2.0 · GitHub
gfvalvo
8
You don't need to install anything. It's included in the ESP32 Arduino Core.
Ok, I can't try it right now on ESP32.
Here is the ref for ESP8266 ( esp_efuse_mac_get_default()) . But still, I cannot use any of those functions:
esp_system.h: No such file or directory
esp_mac.h: No such file or directory
gfvalvo
10
I don't have experience with ESP8266.
system
Closed
11
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.