ESP32, connecting a physical button


I don’t know how to activate the physical buttons of the ESP32 itself.

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

ESP32 DevModule and display GC9A01

What LVGL version are you using?


What do you want to achieve?

The physical button is connected to the ESP32 Pin(14), I am trying to trigger an event when it is pressed.

What have you tried so far?

The sketch is very large, so I will only post a piece sufficient to understand the problem.

pinMode(14, INPUT_PULLUP);
int ButtonPressed;

if (!= digitalRead(14)){
   ButtonPressed = 1;
   // it is necessary to somehow say that the button is pressed

I tried to read the documentation, but I got completely confused. Everyone uses screens with a touchscreen, my project does not provide for this and my screen does not have a touchscreen, only buttons are controlled via a microcontroller.
I am grateful in advance.