Sketch working on Mega 2560 R3 but not on R1/2

MrGlasspoole:
my Sketch is working on the Mega 2560 R3 but not on an older one.

I have no idea of what you are trying to do, the code looks pretty alien. I am only going on the quoted line. The only reason I can think of for this to happen is that there are several differences in the pins between Megas and what I assume is a Uno. This particularly applies to analogue and signal from the clock. I was obliged to move from Uno to Mega2560 and, after a bad start, all the problem lay in calling the pins, and the worst I had to was to put in a flying lead from the clock. I guess going the other way could be just as bumpy.