Serial communication Mega2560+NodeMCU

Hello everybody, i have maybe simple trouble but i don't know what to do. My problem is simple.

I did simple example for serial communication between NodeMCU (v0.9) and arduino UNO. Everything works fine. Pins from Node (D2,D3) is connected to UNO (3,2). I write something on Node and have response on UNO, now when i tested it on UNO i wanted use it on Mega. I just replaced UNO with Mega , used same type of code but nothing happens on Mega. I tried change mega pins to 19,18; common ground but still not works.

My question is simple , how i can use serial communication between NodeMCU and Mega2560

Thank you very much

with Uno you used SoftwareSerial. on Mega just use one of the hardware serials. 18/19 is Serial1

And if @Juraj's advice does not solve the problem post your program and post a diagram showing how you have everything connected.


Juraj solve helps, thank you very much guys. If i find and problem with it i will write here. Thank you