-
You should never print within an interrupt routine (or do anything that takes a significant amount of time, unless you absolutely cannot avoid it).
-
Printing takes time, so in the first program while you are printing, you are probably missing encoder state changes.
Here is a very simple program that doesn’t skip encoder state changes (for the Pololu Orangutan) Quadrature encoder for the O
