You show me code. I'm asking you what hardware you are running it on. Please don't just say "Mega2560". I mean all of your hardware.
Also, look at the mess you posted. Please edit that and put it in code tags. Or, provide a link to the original code, since it's obvious by now that you didn't write it.