How to get the number of devices connected to ESP softAP?

184 views Asked by At

I'm using STM32 as the main microcontroller and an ESP-12F is connected to it via serial port. I'm controlling ESP with AT commands.

I want to figure out how many devices are connected to my ESP. How should I do that?

1

There are 1 answers

0
Roberto Caboni On BEST ANSWER

I assume your device is acting as an access point, meaning that you previously configured it in that whay with

AT+CWMODE=2

The command for obtaining the list of stations connected to the access point is AT+CWLIF:

AT+CWLIF

<IP device 1>,<MAC address device 1>
<IP device 2>,<MAC address device 2>
...
<IP device N>,<MAC address device N>

OK

So, basically, you will get a row containing the <IP>,<MAC address> couple for each connected station. Counting those lines will tell you how many devices are connected to your ESP.