How to make rotary encoder a scrollwheel?


I want to make rotary encoder as a hardware for scrolling page, but how to use it ? i already have input devices (button) . the rotary encoder return some number when it rotates , nah how to convert the number into scroll (?) sorry if bad english.

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

Make encoder as scroll

What have you tried so far?

im already make a function that return some number if encoder rotated.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

void enc_read() {
  CLK_state = pcf8574.digitalRead(CLK_PIN, true);
  if (CLK_state == HIGH && prev_CLK_state == LOW) {
    if (pcf8574.digitalRead(DT_PIN, true) == LOW) {
      changed = true;
    } else {
      changed = true;

  // save last CLK state
  prev_CLK_state = CLK_state;

  //Serial.print("enc sw = ");
  enc_sw_read = pcf8574.digitalRead(SW_PIN);
  if (enc_sw_read != enc_sw_last) {
    changed = true;
    enc_sw_last = enc_sw_read;

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.
pls HELP thanks