Arduino Mega 2560 R3 vs. Uno R3 for beginners {Raspberry Pi}

I can only suspect the china sourced mega is causing problems.

Hardware usually works reliably the way it is wired. On the other hand, 99% of issues like yours are likely to bad code.