How to acces Webpage via Browser on ESP2688 without ip-adress on adressline

Hi there.

As you read on the title, I’m looking out for a way to acces a webpage which is created in ESP2866. My Question is:

How can I (and others) visit the webpage stored on ESP2688 with a name like this: http://myesp2866page

Here are the facts:

  • My ESP2866 runs as am AP-Server, so it has no connection to my home router (and it schould not have)
  • I have tried with a static IP, but unfortunately, the IP changes again

I know, that I can get the actual IP Adress by the Serial Monitor, but others (dummies) witout knowledge of microcontrollers can not get the IP Adress. So now you understand what my Problem is :smiley: The dummies should have acces to the webserver too…

the Problem with the static IP adress worked first, but the last time it did not work. Maybe you have a better solution ?

#include <ESP8266mDNS.h>
#include <ESP8266mDNS_Legacy.h>
#include <LEAmDNS.h>
#include <LEAmDNS_lwIPdefs.h>
#include <LEAmDNS_Priv.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <Adafruit_Sensor.h>

const char* ssid     = "ESP8266";
const char* password = "123456789";
const int ldrPin=A0;
const char* PARAM_INPUT_1 = "input1";
const char* PARAM_INPUT_2 = "input2";
const char* PARAM_INPUT_3 = "input3";
int value = analogRead(ldrPin);

AsyncWebServer server(80);


// index HTML web page
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
  <title>ESP Input Form</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  </head><body>Hello World !</body></html>)rawliteral";

void notFound(AsyncWebServerRequest *request) {
  request->send(404, "text/plain", "Not found");
}







void setup(){
  Serial.begin(115200);
  Serial.print("Setting AP (Access Point)…");
 
  IPAddress ip(192, 168, 2, 99);
  IPAddress dns(192, 168, 1, 1);
  IPAddress gateway(192, 168, 2, 1);
  IPAddress subnet(255, 255, 255, 0);

  WiFi.softAP(ssid, password); // <--- mit Passwort
  WiFi.config(ip, dns, gateway, subnet);
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/html", index_html);
  });
  
  server.onNotFound(notFound);
  server.begin();
}






void loop(){

}

I have an ESP-01 module that I have configured to serve as an Access Point.
It is not connected to my home network.
The default IP address is 192.168.4.1

Okay, are you sure that all devices have a default IP 192.168.4.1 ?
My Device has 192.168.4.1 too. I have found a solution:

I made the IP-Adresse as char*, than I put it as Wifi SSID. So, now it could be any other IP, because I can see it allway as SSID. My problem has been solved.

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