[problem] arduino with esp01 + lora e32 problem

Hello I got problem with my project. Got arduino mega with E32 module and esp01 module connected, after startup program is connecting to wifi and to blynk server and after that should connect to lora e32 and receive data. Without esp and blynk in code e32 is receiving data without problem. Is there problem with multiple software serial? Any ideas? Thanks!

#include <string.h>
#include "Arduino.h"
#include "LoRa_E32.h"
#define FREQUENCY_868
LoRa_E32 e32ttl100(52, 53); //TX ,RX
//Activates communication between the Blynk App and Serial Monitor:
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
//Authentication of account in the Blynk app.
char auth[] = "auth";  //Enter the device's auth token code.
//Enter the WiFi credentials.
char ssid[] = "ssid";//Name of the Wi-Fi network.
char pass[] = "pass"; //Wi-Fi network password.
char hostid[] = "ip";
int port = 8080;
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(50, 51); // RX, TX

// ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);
WidgetLCD lcd0(V0);
WidgetLCD lcd1(V1);

void setup() {
  Serial.begin(9600);
  delay(500);
  Serial.println("Receiving!");
  // Startup all pins and UART
  e32ttl100.begin();
  
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass, hostid, port);

  lcd0.clear();
  lcd1.clear();
}

void loop() {
  Blynk.run();
  // If something available
  if (e32ttl100.available() > 1) {
    // read the String message
    ResponseContainer rc = e32ttl100.receiveMessage();
    // Is something goes wrong print error
    if (rc.status.code != 1) {
      rc.status.getResponseDescription();
    } else {

      // Print the data received
      char str_array[rc.data.length()];
      rc.data.toCharArray(str_array, rc.data.length());

      char * token = strtok(str_array, " ");
      Serial.print("Weight = ");
      Serial.print(token);
      Serial.println(" kg");
      lcd0.print(0,0, token);
      token = strtok(NULL, " "); 
      Serial.print("Voltage= ");
      Serial.print(token);
      Serial.println(" V");
      lcd1.print(0,0, token);
    }
  }
  if (Serial.available()) {
    String input = Serial.readString();
    e32ttl100.sendMessage(input);
  }
}

The mega has multiple serial interfaces. You should use that instead of SoftwareSerial. Does you Mega have the ESP module built into it? If yes, then it's possible its already connected to a hardware serial.

Arduino Mega has no built-in esp, I added one and connected to software serial pins (50, 51). By serial monitor it seems that lora is not receiving data. Screenshot in attachment.

This does not sound like a LoRa issue, the E32 is a UART front ended device, so the problem you are having would be the same if you were using another serial device such as a GPS.

Using multiple software serial interfaces can be made to work, but it needs care in the coding.

Using software serial together with standard serial can also cause problems, which can be difficult to solve.

So, as already suggested, the Mega has multiple hardware serial ports, so you dont need to use software serial at all.

Thanks for responds. I solved it this way:

SoftwareSerial mySerial(52, 53); // RX, TX
LoRa_E32 e32ttl100(&mySerial);

and

mySerial.listen();

frogg1ven:
Thanks for responds. I solved it this way:

SoftwareSerial mySerial(52, 53); // RX, TX

LoRa_E32 e32ttl100(&mySerial);



and 


mySerial.listen();

You might think you have 'solved it' but do test it very (very+) well and dont dont use it for anything that is critical or important.

Using softwareserial when you have an Arduino with plenty of free hardware serial ports makes no sense at all.

Ok, thanks for help, ill try to change it for hardware serial ports.