Point to point 2x (ESP-01+nano)

Hello
about 2 years ago I had started a tele-control with the use of a pair ESP-01+nano as Base and a same pair as Remote. Target was to send “text commands” (a few bytes each) from Remote and receive /recognize/process at Base. After buildind the first part of codes, ie the main connection, I took the Remote and run around some blocks to see the range. Some 100m, ok. Then the guy who asked for the project said “stop”, so the code was never completed (command send/receive/process).
Now I have the same inquiry.
I spent many hours today on this. I didnt step forward not a step: Although connection established, no message was received in either direction (from the TX light going on, it seems something is sent). Both ESPs have level shifters.
Finally, I fried the one of ESPs by connecting it accidentally to 8V without the 3.3 regulator.
I cannot have a replacement before Wednesday.

So, can somebody help by looking to the codes and mention …whatever. it should be easy, perhaps Iam at wrong direction
thank you

//BASE

#include <SoftwareSerial.h>

#include <String.h>
#include <avr/pgmspace.h>
#include <Wire.h>
SoftwareSerial mySerial(4, 5);// rx tx
unsigned char SigQ[50];
unsigned char SigQ1[5] = {
  'a', 'a', 'a', 'a', 'a'
};
unsigned long timing;
long int x = 0;
int y = 0;
char a = ' ';
String txtmsg = "";
int count = 1;

/*
*********************************************************
  setup()
 *********************************************************
*/
void setup()
{
  mySerial.begin(115200);
  Serial.begin(9600);
  delay(1000);
  pinMode(7, OUTPUT);
  Wire.begin();

  mySerial.println("AT+CIOBAUD=9600");
  mySerial.end();
  delay(500);
  mySerial.begin(9600);

  Serial.println("HELLO");

  delay(500);

  mySerial.println("AT");
  delay(1000);
  y = -1;
  mySerial.println("ATE1");
  mySerial.println("AT+CWMODE=3");
  timing = millis();
  while ((y < 0) && (timing + 3000 < millis())) {
    y = got("DE:");
  }
  y = -1;

  mySerial.println("AT+CWSAP?");
  timing = millis();
  while ((y < 0) && (timing + 3000 < millis())) {
    y = got("SAP");
  }
  y = -1;
  mySerial.println("AT+CIPMUX=1");
  timing = millis();

  while ((y < 0) && (timing + 3000 < millis())) {
    y = got("OK");
  }
  y = -1;

  Serial.println("MUX");

  mySerial.println("\"AT+CIPSERVER=1,1234\"");
  timing = millis();
  while ((y < 0) && (timing + 3000 < millis())) {
    y = got("OK");
  }
  Serial.println("STAIP");

  y = -1;
  //send characters
  //  y = got("SEND OK");

  //read backmessage
  // check if connected
}


void loop()
{
  count++;

  while (mySerial.available()) {
    Serial.print(mySerial.read());
  }

  mySerial.println(count);
  delay(5000);


}

int got(String LookFor) {
  txtmsg = "";
  while (mySerial.available() == 0) {
    delay(10);
  }
  while (mySerial.available()) {
    a = mySerial.read();
    txtmsg += a;
    delay(2);
  }
  //look for it
  Serial.print(txtmsg);
  Serial.print("***");
  Serial.println(txtmsg.indexOf(LookFor));
  return txtmsg.indexOf(LookFor)   ;

  txtmsg = "";
}
//code REMOTE

#include <SoftwareSerial.h>
#include <String.h>
#include <avr/pgmspace.h>
#include <Wire.h>
SoftwareSerial mySerial(4, 5);// rx tx

unsigned long timing;
long int x = 0;
int y = 0;
char a = ' ';
String txtmsg = "";
//String myapip = "";
String mystaip = "";
String myssid = "";
//String mypass = "";
String otherapip = "";
String otherstaip = "";
String otherssid = "";
String otherpass = "";


int count = 1;
unsigned long howlong = 2000;
/*
*********************************************************
  setup()
 *********************************************************
*/
void setup()
{ softreset();
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  Wire.begin();
  initi();

  //read backmessage
  //always check if connected
}
void loop()
{
  count++;
  if (myssid == "NO INTERNET D3") {
    howlong = 1200;
    mySerial.println("AT+PING=\"192.168.4.1\"");
    Serial.println(got("+"));
  }
  while (mySerial.available()) {
    Serial.print(mySerial.read());
  }
  while (Serial.available()) {
    // CHECK char1 to see if it is command to /reset/baud 38400
    mySerial.print(Serial.read());
    delay(2);
  }
  mySerial.println("AT+CIPSTATUS");
  y = (got(":"));
  howlong = 4000;
  mySerial.println("AT+CWLAP=\"NO INTERNET D1\"");
  y = (got("-"));

  delay(100);
}
void initi(void) {
  //howlong = 2000;
  Serial.println("HELLO");
  delay(500);
  mySerial.println("AT");
  delay(1000);
  mySerial.println("AT+CWQAP");
  y = got("OK");
  delay(2000);
  mySerial.println("ATE1");
  y = got("OK");
  mySerial.println("AT+CWMODE=3");
  y = got("OK");
  mySerial.println("AT+CWSAP?");
  y = got("D1");
  Serial.println(y);

  //am I D1?
  if (y > 0) {
    //myapip = "192.168.4.1";
    mystaip = "192.168.3.2";
    myssid = "NO INTERNET D1";
    //mypass = "1";
    otherapip = "192.168.3.1";
    otherstaip = "192.168.4.2";
    otherssid = "NO INTERNET D3";
    otherpass = "3";
  }
  else {
    // myapip = "192.168.3.1";
    mystaip = "192.168.4.2";
    myssid = "NO INTERNET D3";
    //mypass = "3";
    otherapip = "192.168.4.1";
    otherstaip = "192.168.3.2";
    otherssid = "NO INTERNET D1";
    otherpass = "1";
  }

  mySerial.println("AT+CIPMUX=1");
  y = got("OK");

  howlong = 5000;
  mySerial.println("AT+CIPSERVER=1,1234");
  y = got("OK");

  howlong = 5000;
  // D3 WITH 317
  //mySerial.println("AT+CWJAP=\"NO INTERNET D1\",\"1\"");
  //D1  NO 317
  y = -1;
  while (y == -1) {
    mySerial.write("AT+CWJAP=\"");
    mySerial.print(otherssid);
    mySerial.write("\",\"");
    mySerial.print(otherpass);
    mySerial.println("\"");

    y = got("GOT IP");
    //  Serial.println("GOT IP*****???*******");
  }
  howlong = 5000;
  mySerial.println("AT+CIFSR");
  y = got("CIFSR:STAIP,");

  //  Serial.println("STAIP");
  //y=get ip (index+13 +24)

  // D3 WITH 317
  //mySerial.println("AT+CIPSTART=0,\"TCP\",\"192.168.4.1\",1234");
  //D1 NO 317
  //mySerial.println("AT+CIPSTART=0,\"TCP\",\"192.168.3.1\",1234");
  y = -1;

  mySerial.write("AT+CIPSTART=0,\"TCP\",\"");
  mySerial.print(otherapip);
  mySerial.write("\",\"1234");
  mySerial.println("\"");


  howlong = 5000;
  y = got("OK");

  // mySerial.println("AT+CIPSEND=0,5");

  // send "1 2 3" eg 5 chars
  //  if (got(">") > -1) mySerial.println("1 2 3"); //...5 6 7.....

  //send characters

  // y = got("SEND OK");
  // y = got("SEND OK");

}
void softreset(void) {
  mySerial.begin(115200);
  delay(500);
  mySerial.println("AT+RST");
  // wait for esp to reset
  delay(5000);
  mySerial.println("AT+CIOBAUD=9600");
  mySerial.end();
  delay(500);
  mySerial.begin(9600);
}


int got(String LookFor) {
  unsigned long timelast = millis() + howlong;
  txtmsg = "";
  while (timelast > millis()) {
    while (mySerial.available())   {
      if (mySerial.available())
        a = mySerial.read();
      txtmsg += a;
    }
  }
  //look for it
  Serial.print(txtmsg);
  Serial.print("***");
  Serial.println(txtmsg.indexOf(LookFor));

  count++;
  return txtmsg.indexOf(LookFor)   ;

}

void lop() {
  for (x = 34800; x < 35000; x = x * 2) {
    Serial.println(x);
    mySerial.end();
    delay(50);
    mySerial.begin(x);
    mySerial.println("AT+CIOBAUD=9600");
    delay(100);
    while (mySerial.available()) {
      Serial.write(mySerial.read());
    }
    Serial.println("HELLO");
  }
}

why to you have a 5 second delay in loop() of you RX code? what happens if something is transmitted during those 5 seconds

gcjr:
why to you have a 5 second delay in loop() of you RX code? what happens if something is transmitted during those 5 seconds

hello.

You are right. If the system was operational that would be a problem. But for testing, the 5 sec are for the tx (ok, they also affect the rx but at this stage it is not important if the buffer is filled up). I repeat tx every 5sec and make changes to other end code to see if a change works on receive something there.

ok, I dont see any activity, perhaps what iask for is too general.

But, while waiting for the new esp-01 (on wednesday) I wander : The esps i used so far were 2 years ago. In these 2 years there have been lots of changes in esp-01 firmware. The AT Instruction set differs. Are the old AT instructions compatible with the new?

For example, on existing sketch there is "AT+CWMODE=". Todays "AT Instruction set" does NOT have "AT+CWMODE=", has "AT+CWMODE_CUR" and "AT+CWMODE_DEF".

Need to change the old sketch?

see Arduino SoftwareSerial limitations (bit rate)