Changing the code from esp32 to esp8266

Hello
The following code is related to the scanning of devices that are connected to the esp access point, it does work on esp32, but it does not compile on esp8266. How can I implement this code for esp8266?

wifi_sta_list_t stationList;
      esp_wifi_ap_get_sta_list(&stationList);
      if (stationList.num >> 0) {
...
}

google:

How to scan devices connected to esp8266 Access Point.

The reason why the code you provided does not compile on ESP8266 is that the ESP8266 WiFi library does not have the wifi_sta_list_t structure or the esp_wifi_ap_get_sta_list function that are specific to the ESP32 WiFi library.

However, you can achieve a similar functionality on the ESP8266

# ifdef ESP32
#  include <WiFi.h>
# elif defined (ESP8266)
#  include <ESP8266WiFi.h>
# endif

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.