Why my encoder work weird?

Hello.
I wants to use a mouse scrollwheel encoder with arduino leonardo. I tried many codes that I find online but none of them worked perfectly. In most cases only turning right or left was correct, in some cases where everything looked perfect, the encoder gives signal in every 2 rotation (not 360°rotation, I mean 2 clicks). Why is it doing it? Thanks

Try to imagine that we can't see your "mouse scrollwheel" or your code, or your wiring

Now. You were saying . . ?

1 Like

Yeah I forgot to upload those.. So here is the encoder:

And here is the wiring:

Then 2 example codes
This is stepping 2:

This is only doing good in one direction:

You must be using some encoder code that only observes changes in one of the two wires, not both of them - find a better library!

1 Like

Well, the first link is working and written to use with these kind of encoders but that's stepping 2 and only for every 2 turns (so rotate click nothing, click 0-->2, click nothing, click 2-->4 etc.). Maybe a slight chance in the code fixes it but I'm trying to solve this for days now. The other code is observing only 1 input but that is working in only one direction, the other direction is bouncing between 2 value OR working randomly. I'm lost

I am SOOOOO dumb.... I just found out from a youtube comment that these encoders have COM on the side not in the middle, I checked it and it is true.. I rewired and the second code is working fine..

Don't depend on YouTube for technical information. Most manufacturers actually publish specifications for their product online. They want people to buy their products. :slight_smile: