1 #include "../../lv_examples.h"
2 #if LV_USE_LED && LV_BUILD_EXAMPLES
3
4 /**
5 * Create LED's with different brightness and color
6 */
lv_example_led_1(void)7 void lv_example_led_1(void)
8 {
9 /*Create a LED and switch it OFF*/
10 lv_obj_t * led1 = lv_led_create(lv_scr_act());
11 lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0);
12 lv_led_off(led1);
13
14 /*Copy the previous LED and set a brightness*/
15 lv_obj_t * led2 = lv_led_create(lv_scr_act());
16 lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0);
17 lv_led_set_brightness(led2, 150);
18 lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
19
20 /*Copy the previous LED and switch it ON*/
21 lv_obj_t * led3 = lv_led_create(lv_scr_act());
22 lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0);
23 lv_led_on(led3);
24 }
25
26 #endif
27