Esp-01 setup error while compilation

Well, the code compiles fine for me, under the Atdiono IDE 1.8.3 for board type “Arduino Mega or Mega 2560”.
It seems you are trying to compile this code for an Uno…

image

However, you didn’t heed my previous advice (no surprise there then!)…

Once you un-comment the first of these lines then you’ll have an object called EspSerial which you need to use in place of Serial in the other two lines of code.

Pete.