ESP NOW MAC address

jwinfieldnz
Posts: 1
Joined: Fri Aug 12, 2022 12:02 am

ESP NOW MAC address

Postby jwinfieldnz » Fri Aug 12, 2022 12:13 am

I have a project where I would like to know the sending MAC address. I am using this library https://github.com/yoursunny/WifiEspNow. At the beginning of the script I use WiFi.macAddress(); to get the MAC address but this is different to the MAC used in transmissions. This MAC address starts with 84 whereas the ESPNOW MAC address starts with 86. How would I get the correct MAC address for ESPNOW?

OutOfLine
Posts: 52
Joined: Sat Feb 24, 2018 1:32 pm

Re: ESP NOW MAC address

Postby OutOfLine » Mon Aug 22, 2022 2:48 pm

To put the mac in my_mac use

Code: Select all

#include "esp_system.h"
uint_8t my_mac[6];
esp_read_mac(my_mac, ESP_MAC_WIFI_STA);
Hope that helps

Who is online

Users browsing this forum: Baidu [Spider] and 55 guests