Sketch is not working with Nano perfectly like Mega2560

liudr:
All you need is to disconnect 3.3V from nano and connect to MEGA2560, then connect grounds of the two.

While this solution will work, if he has to use the MEGA for its 3.3V he might as well just use the MEGA for everything rather than using two arduinos. My guess is that OP wanted to switch away from using the MEGA to using just the nano.