Problem with Arduino Mega and pin 2


I have connected my Nextion (basic 7.0"") to TX/RX2 of an Arduino Mega, using the official library
the thing works fine
on pin #2 (attach 0) , there is a square signal from a speed sensor. before plugging the Nextion, I could measure the speed with arduino software
after I plug the Nextion, the line of pin2 is corrupted: there is a square signal that looks like a transmission, so my signal from the speed sensor is not visible any longer. As a workaround, I plugged my speed sensor to another D pin, it works again, but I would like to use this pin (because it is “attach” pin).

what can I do?


Are you still using your USB connection from your Mega, to your laptop/PC?
RX0/TX0 are at digital pins 0 & 1, maybe there is some interference in between both pins 1 & 2.
Or a bad soldering at the bottom.

And there are more interrupt pins, like D3 see here:
Mega pin layout

I hope this helps :+1: