Problem with sending and/or recieving data from Mega2560 to esp8266

Hi, yes i had the pins connected and i think i solved the problem, after 2 days of trying.

So i edited the code for arduino to look like this:

#include <SoftwareSerial.h>

void setup(){

Serial1.begin(9600);

}

void loop()

{

Serial1.write(1);

Serial1.write(2);

Serial1.write(3);

Serial1.write(4);

}

And in my many attempts to make it work i made ports 19 and 18 as software serial, but they were already hardware serial ports, and it made the program to bug.

But now i have another problem my wemos serial looks like that

-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-11234-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-11234-1-1-1

do you know how to get rid of these -1s? is there a function that only gets serial when its not empty?