Hi...I think that the interrupts used for the MEGA code might be "busy" on the Leonardo because the same code doesn't work.
On the MEGA I was using interrupts #2-5 to read the encoders on ports 18-21. On the Leonardo I'm using ports A2-A5 but the interrupts don't work (maybe they're taken by the bluetooth module or the motor shield?).
https://www.7pcb.com
This is ONLY to be used to report flooding, spam, advertising and problematic (harassing, abusive or crude) posts.