Hi all I have this sketch below which reads connected wifi users MAC addresses, I would like to save these MAC address in to esp8266 EEPROM memory. How would I do that?
If the ESP8266 EEPROM library supports the EEPROM.put() function you can use that and retrieve it again using EEPROM.get() but where in your program is the MAC address ?
EEPROM.write(0,something);
EEPROM.commit();
and
EEPROM.read(0);
Note that I actually suggested using the put() and get() functions not write() and read() as put() and get() allow you to save and read data of any type.
What data type is the bssid array ?
If you had posted a complete sketch then I would not need to ask
PS here is the full code of the sketch that looks up the clients connected to esp8266 and reports back their MAC address which I'm trying to modify to save MAC/BSSID addresses to EEPROM
/*
* Getting MAC and IP Address of Connected devices to ESP8266
* with Soft AP Mode
*/
#include <ESP8266WiFi.h>
extern "C" {
#include<user_interface.h>
}
/* configuration wifi */
const char *ssid = "SSID";
const char *pass = "password";
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
WiFi.softAP(ssid,pass);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
}
void loop() {
delay(5000);
client_status();
delay(4000);
}
void client_status() {
unsigned char number_client;
struct station_info *stat_info;
struct ip_addr *IPaddress;
IPAddress address;
int i=1;
number_client= wifi_softap_get_station_num();
stat_info = wifi_softap_get_station_info();
Serial.print(" Total Connected Clients are = ");
Serial.println(number_client);
while (stat_info != NULL) {
IPaddress = &stat_info->ip;
address = IPaddress->addr;
Serial.print("client= ");
Serial.print(i);
Serial.print(" IP adress is = ");
Serial.print((address));
Serial.print(" with MAC adress is = ");
Serial.print(stat_info->bssid[0],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[1],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[2],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[3],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[4],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[5],HEX);Serial.print(" ");
stat_info = STAILQ_NEXT(stat_info, next);
i++;
Serial.println();
}
delay(500);
}