// dont print anything unless value changed
if (rotaryEncoder.encoderChanged())
{
Serial.println(rotaryEncoder.readEncoder());
}
}
void loop(){
rotary_loop();
}
`
Now , I rotate encoder only in right , I have got in console:
1 2 3 4 5 6 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7
So, right after 8 I get 7 but I didn't turn the encoder to the left, I only turn it to the right.
And value 7 I have got right after 8, without turn encoder.
For example . If I made rotaryEncoder.setBoundaries(0, 9, false);
I will got
1 2 3 4 5 6 7 8 9 8 9 8 9 etc.
Tell me please , how to fix this bug ?
ESP32 board `
define ROTARY_ENCODER_A_PIN 32
define ROTARY_ENCODER_B_PIN 33
define ROTARY_ENCODER_BUTTON_PIN 25
AiEsp32RotaryEncoder rotaryEncoder = AiEsp32RotaryEncoder(ROTARY_ENCODER_A_PIN, ROTARY_ENCODER_B_PIN, ROTARY_ENCODER_BUTTON_PIN, -1, 4);
void setup(){ ... rotaryEncoder.begin(); rotaryEncoder.setup(readEncoderISR); rotaryEncoder.setAcceleration(0); rotaryEncoder.setBoundaries(0, 8, false); rotaryEncoder.setEncoderValue(0); }
void rotary_loop() {
// dont print anything unless value changed if (rotaryEncoder.encoderChanged()) { Serial.println(rotaryEncoder.readEncoder()); } }
void loop(){ rotary_loop(); }
` Now , I rotate encoder only in right , I have got in console: 1 2 3 4 5 6 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 So, right after 8 I get 7 but I didn't turn the encoder to the left, I only turn it to the right. And value 7 I have got right after 8, without turn encoder. For example . If I made rotaryEncoder.setBoundaries(0, 9, false); I will got 1 2 3 4 5 6 7 8 9 8 9 8 9 etc. Tell me please , how to fix this bug ?