Skip to content

RotaryIO Incremental Encoder 'missing' steps #8695

@imdbere

Description

@imdbere

CircuitPython version

Adafruit CircuitPython 8.2.6 on 2023-09-12; Raspberry Pi Pico with rp2040

Code/REPL

import rotaryio
import board

last_encoder_position = None
encoder = rotaryio.IncrementalEncoder(board.GP7, board.GP8, 1)
while True:
    position = encoder.position
    if last_encoder_position is None or position != last_encoder_position:
        print("Encoder pos: " + str(position))
    last_encoder_position = position

Behavior

Hi,
I am using CircuitPython with a generic incremental encoder and i have the following problem: Whenever i turn the encoder it seems to not react to one of the increments and then add two to the next one. So the outputted position increases like 0, 2, 4 etc. while only reacting to every second increment. This means the total amount of increments is correct, but it makes it not really usable for things like an input for a UI.

I did some further measurements and it seems like the library is only counting a step when either of the pins goes from HIGH to LOW, and not doing anything when they go from LOW to HIGH. Is this intended behaviour?
Thanks :)

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrp2040Raspberry Pi RP2040

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions