Skip to content

Is each indent supposed to move counter by one? #27

Description

@moballa

I have a rotatory encoder with pushbutton. I am using this library to read the values from the encoder. Each time I move the encoder one indent, 4 events get triggered advancing the counter by 4. Not sure if this is normal or my encoder is different than the usual expected behavior. I have tried adding #define ENC_DECODER (1 << 2) before including the .h file. I have also tried #define ENC_HALFSTEP with different values with 2 or 3 events getting triggered instead. When I set the 4th parameter of the constructor to 2, only 2 events get triggered but if I change it to the default of 1, 3 events get triggered.

Is there a problem with my encoder? Is there a way to ensure that only one event is triggered per encoder indent so that it only advances the position counter by 1 per indent?

Thanks for any help!

Activity

  1. CyrilSiman commented on Mar 4, 2018

    @CyrilSiman

    Hi,
    I had the same problem on my side and maybe could you fix it with stepsPerNotch in constructor as mentioned in doc :

    Depending on the type of your encoder, you can define use the constructors parameter stepsPerNotch an set it to either 1, 2 or 4 steps per notch, with 1 being the default.

    On my side with a Keyes encoder, I have to specify 4.

  2. floony commented on Jan 31, 2019

    @floony

    Im not very experienced with libraries for arduino, so could someone please explain how to define the stepsPerNotch?
    Thanks a Lot!

  3. themodfatherinc commented on Mar 28, 2019

    @themodfatherinc

    i just had to figure this out, as mine sent 2 per ident. The number of stepsPerNotch is defined as a 4th variable after the analog pins as below.. In this example it defines 2 steps per notch

    void setup() {
    Serial.begin(9600);
    encoder = new ClickEncoder(A1, A2, A3, 2)

    The referenced part in ClickEncoder.h
    ClickEncoder(uint8_t A, uint8_t B, uint8_t BTN = -1,
    uint8_t stepsPerNotch = 1, bool active = LOW);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions