The use of the ESP8266 in the world of IoT

User avatar
By rvinaso
#92855 Hello my friends, I have designed a network with 5 NodeMCUs connected to a router. One of this NodeMCUs will work as master of the network, and the others are slaves. I am using UDP protocol to establish communication between the devices. My question is: How can I get the MAC Address of all the devices connected to the network? Can I obtain it from an incoming packet?? thanks for your help!!
User avatar
By AcmeUK
#92859 You can set your own MAC addresses:- Get ESP32/ESP8266 MAC Address and Change It (Arduino IDE)
Or, if you explicitly need to extract the MAC address see this post UDP With ESP8266 Access Point and for ideas look at the section vis:-

IPaddress = &stat_info->ip;
address = IPaddress->addr;

Serial.print("client= ");

Serial.print(" IP adress is = ");
Serial.print(" with MAC adress is = ");

Serial.print(stat_info->bssid[0],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[1],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[2],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[3],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[4],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[5],HEX);Serial.print(" ");