Skip to content

attachInterrupt missing digitalPinToInterrupt in example  #27

Closed
@Meeresgott

Description

@Meeresgott

Tested your example with Interrupts (InterruptRotator.ino). There is no need the call encoder.tick() in the main loop if the interrupts would work.

Changed your
attachInterrupt(PIN_IN1, checkPosition, CHANGE); attachInterrupt(PIN_IN2, checkPosition, CHANGE);

to

attachInterrupt(digitalPinToInterrupt(PIN_IN1), checkPosition, CHANGE); attachInterrupt(digitalPinToInterrupt(PIN_IN2), checkPosition, CHANGE);
and deleted your tick in the main loop.

Tested on a Arduino Nano V3.

Activity

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions