Rotary encoder.

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Rotary encoder.

Post by dhylands » Thu Mar 12, 2020 7:42 pm

One of the keys is that rotary the bits go through what's known as a gray code. Only one bit changes at a time.

So with two bits, one direction will look like 00 -> 01 -> 11 -> 10 -> 00 ....

and the other direction will just be the above in reverse. This article has a good explanation:
https://lastminuteengineers.com/rotary- ... -tutorial/

and here's a good youtube video with some nice animations:
https://www.youtube.com/watch?v=v4BbSzJ-hz4

And this one talks about debouncing:
https://www.allaboutcircuits.com/projec ... d-project/

Post Reply