Problem reading an encoder correctly

jraskell:

gadi:
Do you think that using interrupts with a 10kHz signal is ok for the Arduino Mega? It's not too fast?

Gadi.

If the Mega isn't doing anything else, no problem at all to handle a 10kHz signal.
If the Mega is doing light processing, still shouldn't be a problem.
If the Mega is doing some heavy processing, could very well be a problem.

Only a problem for the processing, the interrupts always get serviced - its other interrupt routines that you have to worry about.

If you have code that is disabling interrupts for more than a few microseconds at a time though, that could be a big issue. Don't do that!

One thought - replacing the digitalRead() calls in the interrupt routines with direct port manipulation can be a big win.