Skip to content

Add getDirection() support to ModulinoKnob and example ⚑ #34

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AntonioBerna
Copy link

@AntonioBerna AntonioBerna commented May 1, 2025

πŸ“ Description

This PR introduces support for detecting rotation direction in the ModulinoKnob class via a new method:

  • βœ… getDirection() returns 1 for clockwise, -1 for counter-clockwise, and 0 when no movement is detected (debounced).
  • 🧠 Internal debouncing is handled via DEBOUNCE_DELAY to avoid noisy reads.
  • πŸ› οΈ The begin() logic now initializes internal state (_lastPosition, _lastDebounceTime) accordingly.
  • πŸ§ͺ The basic example sketch has been updated to demonstrate the use of getDirection().

πŸ” Related Work

Fixed #9

Added support for character and string-based input to `isPressed()` in `ModulinoButtons`,
so it now accepts both index (0–2) and letter identifiers (`'A'`, `'B'`, `'C'`) matching
the physical button labeling.

Closes arduino-libraries#3
@per1234 per1234 added the enhancement New feature or request label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function for Modulino Knob to detect direction
2 participants