//PINOUT
const byte pin_encoder_clk = 33;
const byte pin_encoder_dt=25;
const byte pin_encoder_sw = 26;
#include "AiEsp32RotaryEncoder.h"
const byte pin_encoder_vcc = -1 ;
const byte encoder_steps = 4;
AiEsp32RotaryEncoder rotaryEncoder = AiEsp32RotaryEncoder(pin_encoder_clk, pin_encoder_dt, pin_encoder_sw, pin_encoder_vcc, encoder_steps);
void IRAM_ATTR readEncoderISR()
{ rotaryEncoder.readEncoder_ISR();}
void setup()
{
Serial.begin(115200);
//initialize rotary encoder
rotaryEncoder.begin();
rotaryEncoder.setup(readEncoderISR);
rotaryEncoder.setBoundaries(-10, 10, false); //minValue, maxValue, circleValues true|false (when max go to min and vice versa)
}
void loop()
{
//in loop call your custom function which will process rotary encoder values
encoder_loop();
delay(50); //or do whatever you need to do...
}