You might get some ideas here: GitHub - gfvalvo/NewEncoder: Rotary Encoder Library See the MultipleEncoders example.