i want to exchange AT commands in between Pro Mini and ESP8266

I would like to exchange AT commands in between Pro Mini and ESP8266.

Recently I am working on a project with Pro Mini and ESP8266. I use Pro Mini to Serial.wirte("AT+ACK")

And once my ESP8266 detects this string it will send something back for e.g. ("AT+ACK"). The the Pro Mini

will do correspondent action once it detects the AT+ACK.

However, when I put the two chips together and try to do the automation it seems not working properly.

do I need to put \r\n when one chip tries to write the AT commands? "e.g.(Serial.wirte("AT+ACK\r\n") ) but at the other side

should I use the following format

 void loop()
    {                                                                                                                                                        
         if (Serial.available())
           {
              String myString = Serial.readStringUntil('\n');
           
              if (myString=="AT+ACK")
              {

}
}

or

 void loop()
    {                                                                                                                                                        
         if (Serial.available())
           {
              String myString = Serial.readStringUntil('\n');
            
              if (myString=="AT+ACK\r\n")
              {

the second scenario seems not working.

Hope someone can give me some suggestions.

I use Pro Mini to Serial.wirte("AT+ACK")

Really? The compiler didn't comlpian about that?

should I use the following format

or

the second scenario seems not working.

I was going to say "Use the one that works", but you already know that one doesn't, so it was pointless to ask if you should use that version.

You somehow, or claim you do, send something to the ESP. The code you posted does NOT prove that you do.

The code you did post gets something from the ESP, though you do not bother printing what you actually got, so you haven't a hope in hell of parsing it.

Why don't you print what you got, between delimiters, so you can see if what you got includes carriage returns or line feeds?