Even a simple "WiFiEsp Example" can be difficult

Here I'm again: I try to switch a LED using an Arduino Nano V3 board, connected to an ESP-01 adapter with an ESP8266-shield.
The program doens't generates errors, but the ESP can't be initialized.
What do I wrong?

/*
Name         WebServerLed-01.ino
Version:     01 

WiFiEsp example: 

Edited by:   xxxxx
Modified:    2020-09-26

WHAT DOES THIS PROGRAM:
 A simple web server that lets you turn on and of an LED via a web page.
 This sketch will print the IP address of your ESP8266 module (once connected)
 to the Serial monitor. From there, you can open that address in a web browser
 to turn on and off the LED on pin 13.
 For more details see: http://yaab-arduino.blogspot.com/p/wifiesp.html

HARDWARE:
- Arduino Nano V3
- ESP8266 shield with ESP-01 adapter
- RX of ESP-shield connected to Arduino Nano pin 6
- TX of ESP-shield connected to Arduino Nano pin 7
- VCC of ESP-shield connected to Arduino Nano 5V
- GND of ESP-shield connected to Arduino Nano GND
- Mini USB program cable

TESTED ON:
IDE 1.8.13 and Arduino Nano V3
*/

//====================
//Libraries
#include "WiFiEsp.h"

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif

char ssid[] = "yyy";            // your network SSID (name)
char pass[] = "zzzz"'          // your network password
int status = WL_IDLE_STATUS;
int pinLED = 13;
int ledStatus = HIGH;

WiFiEspServer server(80);

// use a ring buffer to increase speed and reduce memory allocation
RingBuffer buf(8);

void setup()
{
  
  pinMode(pinLED, OUTPUT);  // initialize digital pin LED_BUILTIN as an output.
  //Serial.begin(112000);   // initialize serial for debugging, removed  because it seems too fast
  Serial.begin(9600);   // initialize serial for debugging
  Serial1.begin(9600);    // initialize serial for ESP module
  WiFi.init(&Serial1);    // initialize ESP module

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  Serial.println("You're connected to the network");
  printWifiStatus();
  
  // start the web server on port 80
  server.begin();
}


void loop()
{
  WiFiEspClient client = server.available();  // listen for incoming clients

  if (client) {                               // if you get a client,
    Serial.println("New client");             // print a message out the serial port
    buf.init();                               // initialize the circular buffer
    while (client.connected()) {              // loop while the client's connected
      if (client.available()) {               // if there's bytes to read from the client,
        char c = client.read();               // read a byte, then
        buf.push(c);                          // push it to the ring buffer

        // printing the stream to the serial monitor will slow down
        // the receiving of data from the ESP filling the serial buffer
        //Serial.write(c);
        
        // you got two newline characters in a row
        // that's the end of the HTTP request, so send a response
        if (buf.endsWith("\r\n\r\n")) {
          sendHttpResponse(client);
          break;
        }

        // Check to see if the client request was "GET /H" or "GET /L":
        if (buf.endsWith("GET /H")) {
          Serial.println("Turn led ON");
          ledStatus = HIGH;
          digitalWrite(pinLED, HIGH);   // turn the LED on (HIGH is the voltage level)
        }
        else if (buf.endsWith("GET /L")) {
          Serial.println("Turn led OFF");
          ledStatus = LOW;
          digitalWrite(pinLED, LOW);    // turn the LED off by making the voltage LOW
        }
      }
    }
    
    // close the connection
    client.stop();
    Serial.println("Client disconnected");
  }
}


void sendHttpResponse(WiFiEspClient client)
{
  // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
  // and a content-type so the client knows what's coming, then a blank line:
  client.println("HTTP/1.1 200 OK");
  client.println("Content-type:text/html");
  client.println();
  
  // the content of the HTTP response follows the header:
  client.print("The LED is ");
  client.print(ledStatus);
  client.println("
");
  client.println("
");
  
  client.println("Click <a href=\"/H\">here</a> turn the LED on
");
  client.println("Click <a href=\"/L\">here</a> turn the LED off
");
  
  // The HTTP response ends with another blank line:
  client.println();
}

void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print where to go in the browser
  Serial.println();
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
  Serial.println();
}

Results from the monitor:
17:13:59.011 -> [WiFiEsp] Initializing ESP module
17:13:59.998 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:01.999 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:04.027 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:06.024 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:08.023 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:09.036 -> [WiFiEsp] Cannot initialize ESP module
17:14:15.030 -> [WiFiEsp] >>> TIMEOUT >>>
17:14:15.030 -> [WiFiEsp] No tag found
17:14:15.064 -> WiFi shield not present

you wired RX to RX, TX to TX? it should be RX to TX if you connect the ATmega to esp8266
did you set the AT firmware's UART to 9600 baud?

Now I connected RX to TX and TX to RX, but the program comes with the same results.

Why are you using a Nano as well as the ESP-01? :roll_eyes:

ArduinoStarter1:
Now I connected RX to TX and TX to RX, but the program comes with the same results.

and the baud rate?

I use the the ESP01-adapter for adaptation of the voltages.
I tried several baudrates.

ArduinoStarter1:
I use the the ESP01-adapter for adaptation of the voltages.
I tried several baudrates.

don't try several but set same on both sides. 9600 is goof for the WiFiEsp library