How can I know if I have a client connected to the ESP ?
Posted: Mon May 06, 2019 9:48 am
OS: Linux Mint 19.1
Board: ESP32 Wrover-B DEV KIT V4
Hello !
I'm having difficulties finding a way to know when a client has connected to the ESP when it is in STA Mode.
Is there a way of knowing if and who connected to the ESP ?
I found WiFi.softAPgetStationNum(); for AP Mode, but I couldn't find a similar function for STA Mode.
Thank you !
Board: ESP32 Wrover-B DEV KIT V4
Hello !
I'm having difficulties finding a way to know when a client has connected to the ESP when it is in STA Mode.
Code: Select all
#include <WiFi.h>
void setup() {
WiFi.begin(ssid, password);
delay(500);
int k = 0;
while (WiFi.status() != WL_CONNECTED && k<20) {
k++;
delay(1000);
Serial.println((String)"Attempt " + k + " - Connecting to WiFi..");
}
if(WiFi.status() == WL_CONNECTED) {
String IP = WiFi.localIP().toString();
Serial.println((String)"Connected to " + ssid + " with IP addres: " + IP);
}
}
I found WiFi.softAPgetStationNum(); for AP Mode, but I couldn't find a similar function for STA Mode.
Thank you !