Using WiFi.BSSID and WiFi.BSSIDstr gives me some weird mac address.
the code is:
#include "ESP8266WiFi.h"
#include "ESP8266WiFiScan.h"
void setup() {
Serial.begin(115200);
//WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
Serial.println(WiFi.macAddress());
}
void loop() {
int n=WiFi.scanNetworks();
Serial.println(n);
for (int network = 0; network < n; network++){
Serial.println(WiFi.SSID(network));
Serial.println(WiFi.RSSI(network));
uint8_t* mac=WiFi.BSSID(n);
char APmac[13];
APmac[0]=0;
for (int i=0; i<6;i++) {
char buffer[3];
sprintf(buffer, "%02x", mac[i]);
strncpy((char *)(APmac+(i*2)), buffer, 3);
Serial.print("["); Serial.print(i); Serial.print("]"); Serial.println(buffer);
}
Serial.println(APmac);
Serial.println(WiFi.BSSIDstr(n));
}
Serial.println();
Serial.println();
delay(10000);
}
The current output is 6D:98:C9:00:00:00 which is completely off. It duplicates this output for other APs too. Is this a hardware problem? I've seen other people using the same codes and it works for them. For reference WiFi.SSID(); and WiFi.RSSI(); both spits out correctly.
edit: I was testing both output to see which ever one was correct and unfortunately they're both wrong