igorantolic / ai-esp32-rotary-encoder

Easy implement rotary encoder to your application using microcontroler like ESP32
GNU General Public License v2.0
284 stars 70 forks source link

Encoder button is not working #54

Closed arslan437 closed 1 year ago

arslan437 commented 1 year ago

My encoder has a pull-down resistor on the PCB. Is there a way to make pull down button work with this library.

igorantolic commented 1 year ago

in AiEsp32RotaryEncoder.cpp there is logic

if (this->encoderButtonPin >= 0)
{
    pinMode(this->encoderButtonPin, INPUT_PULLUP);
}

You should set encoderButtonPin to a negative value like encoderButtonPin =-1 Then use your own logic for a button (treat is as a normal button and do the logic)