-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rotary example #8
Comments
I think something goes wrong with the bitshifting in this part of rotary:
output:
|
I have modified the code and this seems to be working for me instead:
|
Hi @bakman2 In an ideal world, an encoder should produce 4x states per step. One step clockwise: One step counter-clockwise: This line is combining the clk + dt values with the last 3 executions. Could also be written as:
The last CD bits in both 8-bit sequences are Looking at your example with state in binary, it shows some missed steps in the sequence
This could be caused by not polling fast enough, or a flakey encoder, loose wiring, all of the above, etc. In your solution, you're using the CD states 11 and 10 to +/- the step. I'll try to replicate on some of my old encoders. |
Does the rotary example work properly ?
I do get the
switch: 1
when pressed, but when rotating, I get the same thing, it does not update the value, just repeatingswitch 1
The text was updated successfully, but these errors were encountered: