Create web server with uno and ESP8266

Hi,
I want to create an web server with Arduino uno and ESP8266.
Here is my code:

#include <SoftwareSerial.h>
const byte rxPin = 2;
const byte txPin = 3;

SoftwareSerial ESP8266 (rxPin, txPin);

unsigned long lastTimeMillis = 0;

int triedTime = 0;

void setup() {
  Serial.begin(9600);   
  ESP8266.begin(115200);
  //ESP8266.begin(2000000);
  triedTime = 0;
  createServer();
  Serial.println("");
  Serial.println("Server is Ready");
  Serial.println("");   
   
}

void createServer(){
  ESP8266.println("AT+CWSAP=\"Rmt\",\"1234test\",5,3");
  delay(500);
  ESP8266.println("AT+CIPMUX=1");
  delay(500);
  ESP8266.println("AT+CIPSERVER=1,80");

  

}
void printResponse() {
  while (ESP8266.available()) {
    Serial.println(ESP8266.readStringUntil('\n')); 
  }
}

void loop() {
  
    if ( Serial.available() )
    {  
     delay(1000);
 
     int connectionId = ESP8266.read()-48; // subtract 48 because the read() function returns 
                                           // the ASCII decimal value and 0 (the first decimal number) starts at 48
     
     String webpage = "<h1>Hello</h1>&lth2>World!</h2><button>LED1</button>";
 
     String cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend +=webpage.length();
     cipSend +="\r\n";
     
     sendData(cipSend,1000);
     sendData(webpage,1000);
     
     webpage="<button>LED2</button>";
     
     cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend +=webpage.length();
     cipSend +="\r\n";
     
     sendData(cipSend,1000);
     sendData(webpage,1000);
 
     String closeCommand = "AT+CIPCLOSE="; 
     closeCommand+=connectionId; // append connection id
     closeCommand+="\r\n";
     
     sendData(closeCommand,3000);
    }

    if(triedTime<=2)
    {
      createServer();
      triedTime +=1;
    }
}
String sendData(String command, const int timeout)
{
    String response = "";
    
    ESP8266.print(command); // send the read character to the esp8266
    
    long int time = millis();
    
    while( (time+timeout) > millis())
    {
      while(ESP8266.available())
      {
        // The esp has data so display its output to the serial window 
        char c = ESP8266.read(); // read the next character.
        response+=c;
      }  
    }
    Serial.print(response);
  
    return response;
}

and here is board options:

everything seems ok, i can connect to this device via android phone.

I just have one question, how can I get this device Local IP?

when I use this code to print local IP:

Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

it gives me this error:

'WiFi' was not declared in this scope

when I include this code:

#include <ESP8266WiFi.h>

it gives me this error:

Error compiling for board Arduino/Genuino Uno.

I don’t know how can I get this ip.

ramtinak:
I want to create an web server with Arduino uno and ESP8266.

Why don't you just use the Arduino ESP8266 core and write the code write totally on the ESP? It's a more powerful processor with more RAM and you don't have to mess around with AT commands or SoftwareSerial.

gfvalvo:
Why don’t you just use the Arduino ESP8266 core and write the code write totally on the ESP? It’s a more powerful processor with more RAM and you don’t have to mess around with AT commands or SoftwareSerial.

Because I don’t have that one!

ramtinak:
Because I don't have that one!

Instructions for in stalling the ESP8266 core into Arduino IDE:

@gfvalvo
Esp and arduino with at commands is working perfectly fine. No hangups or restart 2 months so far.

My system:
Main unit with 4 child units all on arduino uno with esp8266-01 as wifi shield.

@surepic
can you help me please?

surepic:
@gfvalvo
Esp and arduino with at commands is working perfectly fine. No hangups or restart 2 months so far.

I’m sure it is. I just don’t understand why someone would want to write their main application code on an 8-bit, 16MHz, 2KB machine and then use a 32-bit, 80 MHz, 80KB machine with built-in TCP/IP Stack as only a peripheral connected by buggy SoftwareSerial.

Be that as it may, look at the WiFiESP library.

gfvalvo:
I’m sure it is. I just don’t understand why someone would want to write their main application code on an 8-bit, 16MHz, 2KB machine and then use a 32-bit, 80 MHz, 80KB machine with built-in TCP/IP Stack as only a peripheral connected by buggy SoftwareSerial.

Be that as it may, look at the WiFiESP library.

I agree