Using interrupts for a rotary encoder

Hi guys,

I have a rotary encoder that I am trying to use to work as a heading selector in an auto-pilot panel for my simulator. Basically all I need is the rotary encoder that changes a stored value that is supposed to be between 0 and 359. I managed to get the rotary encoder working, however the value jumps up and down like crazy every time I try to change it, sometimes the value increases by much more than I turned (I turn 1 step and value increases by 5) or after increasing by 1 step the value increases and comes back (1, 0, 1, 0).

I was recommended to use interrupts but I have no idea what it is, how to use it, and whether will it improve anything.

Any help? Please? :)


I don't think I have seen a good rotary encoder solution that did NOT require use of interrupts.

There is a solution you can look at that might make it easier for you.

With a wheel controlled by hand I don't see a problem to go without interrupts and still use a rotary encoder, given your Arduino don't have to do anything else needing a lot of CPU power (doesn't have to be actively calculating, waiting like the SoftwareSerial is doing kills such an application too, even with interrupts).

Show us the code you have, maybe we find some mistakes that are easily fixed. Even if we don't we may be able to help you integrate the interrupt handlers.