init Files
This commit is contained in:
7
libraries/lvgl/examples/widgets/led/index.rst
Normal file
7
libraries/lvgl/examples/widgets/led/index.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
LED with custom style
|
||||
---------------------
|
||||
|
||||
.. lv_example:: widgets/led/lv_example_led_1
|
||||
:language: c
|
||||
|
||||
26
libraries/lvgl/examples/widgets/led/lv_example_led_1.c
Normal file
26
libraries/lvgl/examples/widgets/led/lv_example_led_1.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LED && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Create LED's with different brightness and color
|
||||
*/
|
||||
void lv_example_led_1(void)
|
||||
{
|
||||
/*Create a LED and switch it OFF*/
|
||||
lv_obj_t * led1 = lv_led_create(lv_screen_active());
|
||||
lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0);
|
||||
lv_led_off(led1);
|
||||
|
||||
/*Copy the previous LED and set a brightness*/
|
||||
lv_obj_t * led2 = lv_led_create(lv_screen_active());
|
||||
lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_led_set_brightness(led2, 150);
|
||||
lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
|
||||
|
||||
/*Copy the previous LED and switch it ON*/
|
||||
lv_obj_t * led3 = lv_led_create(lv_screen_active());
|
||||
lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0);
|
||||
lv_led_on(led3);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user