Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By anujmattoo
#58859 I am working on a project in which, the mobile app/browser sends HTTP command to ESP8266 in AP mode. The default IP address of ESP is 192.168.4.1. Therefore in order to connect the ESP to WiFi, the command goes like this :- 192.168.4.1/SSID=XYZ/Pass=XYZ.

On connecting to router, the ESP goes into STA mode and Doesn't create AP until WiFi is not found to which it was connected earlier. Now when ESP is connected to router, the router assigns the IP to ESP through which HTTP command will be sent. On Serial monitor, it does show the IP address to which it is assigned, but what if app controls the ESP, there is no serial communication. How will app know the IP address assigned to particular ESP8266? Is there any way app can scan the router? Or any other way to do this? If there are multiple ESP connected to router, how can I identify the IP of particular ESP.
User avatar
By chupo_cro
#58871 Assign a static IP address to the ESP8266 so you will know the address in advance. Example:

Code: Select allIPAddress ip(192,168,1,xx);               // desired IP address
IPAddress gateway(192,168,1,yy);          // IP address of the router
IPAddress subnet(255,255,255,0);

WiFi.begin(ssid, password);
WiFi.config(ip, gateway, subnet);

while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
}
User avatar
By eduperez
#58879 If you can, configure the DHCP server in the router to assign always the same IP address to each ESP device, then use that IP address; even better if you can configure the DNS server in the router, so they also have a domain name.

You can also explore service discovery protocols.