SunilV:
tried once to post but the photos files were too large.
Reduce the images to 640x480 and there should be no problem
sorry not good at sketches - wiring as per code.
You really do need to post a wiring diagram because that is quite likely where the problem lies - especially if you have not changed the code when moving from the Uno to the Mega.
The business of making a drawing is a great way to find mistakes.
...R