ESP32 with Ai "Esp32 Rotary Encoder@^1.4" library dosn't work!

Hello,

I have set up a new ESP32 project using the AZ Delivery Dev Kit V4. I want to use a rotary encoder with the library “Ai Esp32 Rotary Encoder@^1.4”.

After installing the library and starting the demo program I get the following error message via RS232 :

[ 15][E][esp32-hal-gpio.c:102] __pinMode(): Invalid pin selected E (11) gpio: gpio_set_level(226): GPIO output gpio_num error

I have tested different ESP32 µC variants, all with the same result. The encoder button works but the encoder function does not work.

Can someone help me with this?

Best

RM

#include "AiEsp32RotaryEncoder.h"
#include <Arduino.h>

#define ROTARY_ENCODER_A_PIN 25
#define ROTARY_ENCODER_B_PIN 26
#define ROTARY_ENCODER_BUTTON_PIN 27
#define ROTARY_ENCODER_STEPS 4

AiEsp32RotaryEncoder rotaryEncoder = AiEsp32RotaryEncoder(ROTARY_ENCODER_A_PIN, ROTARY_ENCODER_B_PIN, ROTARY_ENCODER_BUTTON_PIN, -1, ROTARY_ENCODER_STEPS);

/*
FM radio tunner is suposed to set frequency between 88.0 MHz and 104.0 MHz by 0.1MHz steps
Rotary encoder works with integers so we will map 88.0 to 166 and then divide by 10 to get 0.1 steps
frequency = rotaryValue / 2;
*/

float getFrequency()
{
    return (float)rotaryEncoder.readEncoder() / 10.0;
}

void rotary_onButtonClick()
{
    static unsigned long lastTimePressed = 0;
    if (millis() - lastTimePressed < 200)
        return;
    lastTimePressed = millis();

    Serial.print("Radio station set to ");
    Serial.print(getFrequency());
    Serial.println(" MHz ");
}

void IRAM_ATTR readEncoderISR()
{
    rotaryEncoder.readEncoder_ISR();
}

void setup()
{
    Serial.begin(115200);

    digitalWrite(ROTARY_ENCODER_A_PIN, PULLUP);
    digitalWrite(ROTARY_ENCODER_B_PIN, PULLUP);
    digitalWrite(ROTARY_ENCODER_BUTTON_PIN, PULLUP);

    rotaryEncoder.begin();
    rotaryEncoder.setup(readEncoderISR);
    rotaryEncoder.setBoundaries(88 * 10, 104 * 10, true); //minValue, maxValue, circleValues true|false (when max go to min and vice versa)
    rotaryEncoder.setAcceleration(50);
    rotaryEncoder.setEncoderValue(92.1 * 10); //set default to 92.1 MHz
    Serial.println("FM Radio");
    Serial.print("Radio station initially set to ");
    Serial.print(getFrequency());
    Serial.println(" MHz. Tune to some other station like 103.2... and press button ");

}

void loop()
{
    if (rotaryEncoder.encoderChanged())
    {
        Serial.print(getFrequency(), 1);
        Serial.println(" MHz ");
    }
    if (rotaryEncoder.isEncoderButtonClicked())
    {
        rotary_onButtonClick();
    }
}