Open woodencase01 opened 2 years ago
Ok, I just found "#include <menuIO/rotaryEventIn.h>" and it solved my problem.
Using Paul library, I got the encoder to work wonderfully.
Thanks for providing this example code. Here is my current knob code:
void updateKnob()
{
int32_t newKnobPosition = knob.read();
deltaKnobPosition = newKnobPosition - currentKnobPosition;
if (newKnobPosition != currentKnobPosition && (deltaKnobPosition % 4) == 0) // The knob has turned and the turn is finished (4 increments)
{
currentKnobPosition = newKnobPosition;
if (deltaKnobPosition > 0)
{
reIn.registerEvent(RotaryEventIn::EventType::ROTARY_CW);
}
else
{
reIn.registerEvent(RotaryEventIn::EventType::ROTARY_CCW);
}
}
}
I used this library in the past with good success: https://github.com/PaulStoffregen/Encoder using interrupt pins(all pin are interrupt capable) from the Teensy (6 & 7)
Keeping the same hardware setup, I switched to the provided "<menuIO/encoderIn.h>". However, I started having strange behavior such as not moving as the encoder rotates, or moving more than supposed (sometimes scrolling for one second).
Here is my code regarding the encoder:
Is there something I did wrong? Is there a way I could use the original library from Paul for the encoder?