ESP 32 Mac Address

Having Error getting my mac address for the Arduino ESP32
Error Code:
C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino: In function 'void setup()':
C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino:6:8: error: 'class CWifi' has no member named 'mode'
WiFi.mode(WIFI_MODE_STA);
^~~~
C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino:6:13: error: 'WIFI_MODE_STA' was not declared in this scope
WiFi.mode(WIFI_MODE_STA);
^~~~~~~~~~~~~
C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino:6:13: note: suggested alternative: 'WIFI_FILE_READ'
WiFi.mode(WIFI_MODE_STA);
^~~~~~~~~~~~~
WIFI_FILE_READ
C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino:7:34: error: no matching function for call to 'CWifi::macAddress()'
Serial.println(WiFi.macAddress());
^
In file included from C:\Users\Faust\Downloads\Get_MAC_Address\Get_MAC_Address.ino:1:0:
C:\Users\Faust\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.2\libraries\WiFiS3\src/WiFi.h:155:14: note: candidate: uint8_t* CWifi::macAddress(uint8_t*)
uint8_t* macAddress(uint8_t* mac);
^~~~~~~~~~
C:\Users\Faust\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.2\libraries\WiFiS3\src/WiFi.h:155:14: note: candidate expects 1 argument, 0 provided

exit status 1

Compilation error: 'class CWifi' has no member named 'mode'

Code:

#include "WiFi.h"
 
void setup()
{
  Serial.begin(115200);
  WiFi.mode(WIFI_MODE_STA);
  Serial.println(WiFi.macAddress());
}
void loop()
{
}

You are NOT compiling for an ESP32 based board, but for an Arduino Uno R4 where the ESP32 is only used as a WiFi module.

1 Like

It works now, I guess I didn't look close enough. Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.