Example code from here: https://www.arduino.cc/en/Reference/WiFiBSSID (https://www.arduino.cc/en/Reference/WiFiBSSID)
#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 status
void 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 () {}
It won't compiled, error in WiFi.BSSID(bssid).
The error message: invalid conversion from 'byte* {aka unsigned char*}' to 'uint8_t {aka unsigned char}' [-fpermissive]
How to fix it?
It compiles OK for me
Board : Nano
IDE : 1.8.5
OS : Win 10
Can't compile on me.
Board: ESP32
IDE: 1.8.7
OS: Win 10
Sounds like a problem in the ESP32 Core. Figure out who maintains that and ask them to fix it.
Can't compile on me.
Board: ESP32
IDE: 1.8.7
OS: Win 10
It compiles OK for me with the Arduino esp8266 core.
Board : Wemos D1 esp8266
IDE : 1.8.5
OS : Win 10
More confirmation for
@johnwasser
Sounds like a problem in the ESP32 Core
Any update on this error.
No error for Uno but getting this error on ESP8266
Here is the documentation for ESP8266 Wifi Scan Class
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/scan-class.html
(https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/scan-class.html)
The method BSSID takes an uint8_t parameter (networkItem) that is the zero based index of networks discovered during the scan, and return a uint8_t (aka byte) pointer to the BSSID
So, for example, if your network has index 0, you can read the BSSID this way
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
....
}