That's to be expected. Those pins are also used for uploads so the ESP8266 interferes. Luckily you have 3 more hardware serial ports on your Mega, just connect the ESP8266 to a different one and update your code accordingly.
That's to be expected. Those pins are also used for uploads so the ESP8266 interferes. Luckily you have 3 more hardware serial ports on your Mega, just connect the ESP8266 to a different one and update your code accordingly.