---
title: "LVGL: Keypad and encoder"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/third_party/lvgl/keypad_encoder/
last_updated: 2026-11-21
sdk_version: 4.44
---
# LVGL: Keypad and encoder

Source: https://developer.repebble.com/pebbleos/docs/samples/third_party/lvgl/keypad_encoder/

This sample runs the keypad and encoder demo that comes with [LVGL](https://developer.repebble.com/pebbleos/docs/third_party/lvgl.md): tabs of widgets that are used without a pointer. Up and Down move the focus, Select clicks or edits the focused widget and Back leaves it.

Unlike most samples it does not end.

Run:

`pbl samples samples/third_party/lvgl/keypad_encoder`

Boards:

every board

## Sources

src/main.c

```
#include \<stdio.h\>#include \<pbl/kernel/delay.h\>#include \<demos/lv\_demos.h\>#include \<pbl\_lvgl.h\>int main(void) {int ret;ret = pbl\_lvgl\_init();if (ret != 0) {fprintf(stderr, "lvgl: init failed (%d)\n", ret);return ret;}/\* The demos come with LVGL, each enabled by its CONFIG\_LV\_USE\_DEMO\_\* option. \*/lv\_demo\_keypad\_encoder();printf("lvgl: keypad and encoder on %dx%d\n",(int)lv\_display\_get\_horizontal\_resolution(pbl\_lvgl\_get\_display()),(int)lv\_display\_get\_vertical\_resolution(pbl\_lvgl\_get\_display()));while (true) {pbl\_sleep\_ms(lv\_timer\_handler());}}
```

## Output

```
lvgl: keypad and encoder on \d+x\d+
```

Generated from PebbleOS [4bbc630fa](https://github.com/coredevices/pebbleos/commit/4bbc630fa451369e352c06b8276c7fe37c67f4fd). This page is maintained in the pebbleos repository: [docs/samples/third\_party/lvgl/keypad\_encoder.md](https://github.com/coredevices/pebbleos/blob/4bbc630fa451369e352c06b8276c7fe37c67f4fd/docs/samples/third_party/lvgl/keypad_encoder.md).
