You are creating a SoftwareSerial port called EspSerial
and initialising it at 115200 baud.
Unfortunately, the Arduino Uno or Nano that you’re using doesn’t have the processing power to emulate a serial port at this speed, so it’s working for a very short while, then failing.
You need to change the ESP8266_BAUD
value to 9200, but at the same time you need to re-configure your ESP8266 to also communicate at 9200 baud. How you do this will depend on the hardware you are using and whether you have an FTDI adapter available to you.
More info on this issue here…
Pete.