#include <WiFi.h>//SSID of your network char ssid[] = "yourNetwork";//password of your WPA Network char pass[] = "secretPassword";int status = WL_IDLE_STATUS; // the Wifi radio's statusvoid setup(){ WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // if you are connected, print out info about the connection: else { // print the MAC address of the router you're attached to: byte bssid[6]; WiFi.BSSID(bssid); Serial.print("BSSID: "); Serial.print(bssid[5],HEX); Serial.print(":"); Serial.print(bssid[4],HEX); Serial.print(":"); Serial.print(bssid[3],HEX); Serial.print(":"); Serial.print(bssid[2],HEX); Serial.print(":"); Serial.print(bssid[1],HEX); Serial.print(":"); Serial.println(bssid[0],HEX); }}void loop () {}
Can't compile on me.Board: ESP32IDE: 1.8.7OS: Win 10
Sounds like a problem in the ESP32 Core
uint8_t *ptrBSSID = Wifi.BSSID(0);uint8_t bssid[6];if (ptrBSSID == NULL){ // error, no network with this index}else{ // copy the BSSID to your local array memcpy(bssid,ptrBSSID,6); // do something with the bssid ....}