The encoder is attached to gears such that when my motor moves, so does the shaft of the encoder.
When I use pulseIn(), my numbers are jumping around when I'm not moving my motor/encoder. Any idea what's wrong?
My code is below and see the attached picture for a sample output.
Do you have a oscilloscope you could use to check the pulse output of the device? Perhaps some kind of electrical noise is getting into the data stream/
I don't know how the timer0 interrupt would affect it. It'll jump between single digit numbers to 4 digit numbers. The numbers change sporadically and don't seem related to the motion of the motor at all. I can't figure out what's wrong.
pulseIn has to be called "at least a few dozen microseconds before the start of the pulse",
which you aren't doing.
You need to call it twice in a row and take the second result if starting off unsynchronized
I think... Either that or wait for the line to go idle in a tight loop first.