-->
Page 1 of 1

Store a connected wifi client MAC address to EEPROM?

PostPosted: Fri Dec 13, 2019 3:21 am
by MyESP
Hi all I have this sketch below which reads connected wifi users MAC addresses, I would like to save these MAC address into esp8266 EEPROM memory. How would I do that?

Code: Select all#include<user_interface.h>
.....
....
....

void loop() {
  delay(5000);
  client_status();
  delay(4000);
}

void client_status() {

  unsigned char number_client;
  struct station_info *stat_info;
 
//  struct ip_addr *IPaddress;
  struct ip4_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(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);
}

Re: Store a connected wifi client MAC address to EEPROM?

PostPosted: Fri Dec 13, 2019 9:01 am
by martinayotte
There are examples of EEPROM emulation librairy here :
https://github.com/esp8266/Arduino/tree ... ies/EEPROM