1# Demos for LVGL 2 3## Add the examples to your projects 41. demos can be found in the 'demos' folder once you clone the lvgl. 5 62. In the ***lv_conf.h*** or equivalent places, you can find demo related macros, change its value to enable or disable specified demos: 7 8```c 9... 10/*=================== 11 * DEMO USAGE 12 ====================*/ 13 14/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ 15#define LV_USE_DEMO_WIDGETS 0 16#if LV_USE_DEMO_WIDGETS 17#define LV_DEMO_WIDGETS_SLIDESHOW 0 18#endif 19 20/*Demonstrate the usage of encoder and keyboard*/ 21#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 22 23/*Benchmark your system*/ 24#define LV_USE_DEMO_BENCHMARK 0 25 26/*Stress test for LVGL*/ 27#define LV_USE_DEMO_STRESS 0 28 29/*Music player demo*/ 30#define LV_USE_DEMO_MUSIC 0 31#if LV_USE_DEMO_MUSIC 32# define LV_DEMO_MUSIC_SQUARE 0 33# define LV_DEMO_MUSIC_LANDSCAPE 0 34# define LV_DEMO_MUSIC_ROUND 0 35# define LV_DEMO_MUSIC_LARGE 0 36# define LV_DEMO_MUSIC_AUTO_PLAY 0 37#endif 38... 39``` 40 413. If your development environment or toolchain does not add source files inside '***lvgl***' folder automatically, ensure the `demos` folder is included for compilation. 424. Include "***demos/lv_demos.h***" in your application source file, for example: 43 44```c 45//! main.c 46#include "lvgl.h" 47#include "demos/lv_demos.h" 48... 49``` 50 51 52 53## Demos 54 55### Widgets 56Shows how the widgets look like out of the box using the built-in material theme. 57 58See in [widgets](https://github.com/lvgl/lvgl/tree/master/demos/widgets) folder. 59 60<img src="https://github.com/lvgl/lvgl/tree/master/demos/widgets/screenshot1.png?raw=true" width=600px alt="Basic demo to show the widgets of LVGL"> 61 62For running this demo properly, please make sure **LV_MEM_SIZE** is at least **38KB** (and **48KB** is recommended): 63 64```c 65#define LV_MEME_SIZE (38ul * 1024ul) 66``` 67 68 69 70### Music player 71The music player demo shows what kind of modern, smartphone-like user interfaces can be created on LVGL. It works the best with display with 480x272 or 272x480 resolution. 72 73See in [music](https://github.com/lvgl/lvgl/tree/master/demos/music) folder. 74 75<img src="https://github.com/lvgl/lvgl/tree/master/demos/music/screenshot1.gif?raw=true" width=600px alt="Music player demo with LVGL"> 76 77### Keypad and encoder 78LVGL allows you to control the widgets with a keypad and/or encoder without a touchpad. This demo shows how to handle buttons, drop-down lists, rollers, sliders, switches, and text inputs without touchpad. 79Learn more about the touchpad-less usage of LVGL [here](https://docs.lvgl.io/master/overview/indev.html#keypad-and-encoder). 80 81See in [keypad_encoder](https://github.com/lvgl/lvgl/tree/master/demos/keypad_encoder) folder. 82 83<img src="https://github.com/lvgl/lvgl/tree/master/demos/keypad_encoder/screenshot1.png?raw=true" width=600px alt="Keypad and encoder navigation in LVGL embedded GUI library"> 84 85### Benchmark 86A demo to measure the performance of LVGL or to compare different settings. 87See in [benchmark](https://github.com/lvgl/lvgl/tree/master/demos/benchmark) folder. 88<img src="https://github.com/lvgl/lvgl/tree/master/demos/benchmark/screenshot1.png?raw=true" width=600px alt="Benchmark demo with LVGL embedded GUI library"> 89 90### Stress 91A stress test for LVGL. It contains a lot of object creation, deletion, animations, style usage, and so on. It can be used if there is any memory corruption during heavy usage or any memory leaks. 92See in [stress](https://github.com/lvgl/lvgl/tree/master/demos/stress) folder. 93<img src="https://github.com/lvgl/lvgl/tree/master/demos/stress/screenshot1.png?raw=true" width=600px alt="Stress test for LVGL"> 94 95## Contributing 96For contribution and coding style guidelines, please refer to the file docs/CONTRIBUTING.md in the main LVGL repo: 97 https://github.com/lvgl/lvgl 98