2021-04-08 13:07:48 +02:00
|
|
|
#include "../../lv_examples.h"
|
2021-02-14 14:56:34 +01:00
|
|
|
#if LV_USE_LED && LV_BUILD_EXAMPLES
|
2021-02-08 09:53:03 +01:00
|
|
|
|
2021-02-14 14:56:34 +01:00
|
|
|
/**
|
|
|
|
* Create LED's with different brightness and color
|
|
|
|
*/
|
2021-02-08 09:53:03 +01:00
|
|
|
void lv_example_led_1(void)
|
|
|
|
{
|
|
|
|
/*Create a LED and switch it OFF*/
|
|
|
|
lv_obj_t * led1 = lv_led_create(lv_scr_act());
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0);
|
2021-02-08 09:53:03 +01:00
|
|
|
lv_led_off(led1);
|
|
|
|
|
|
|
|
/*Copy the previous LED and set a brightness*/
|
|
|
|
lv_obj_t * led2 = lv_led_create(lv_scr_act());
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0);
|
2021-02-14 14:56:34 +01:00
|
|
|
lv_led_set_brightness(led2, 150);
|
2021-04-23 12:46:14 +02:00
|
|
|
lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
|
2021-02-08 09:53:03 +01:00
|
|
|
|
|
|
|
/*Copy the previous LED and switch it ON*/
|
|
|
|
lv_obj_t * led3 = lv_led_create(lv_scr_act());
|
2021-03-25 16:14:17 +01:00
|
|
|
lv_obj_align(led3, LV_ALIGN_CENTER, 80, 0);
|
2021-02-08 09:53:03 +01:00
|
|
|
lv_led_on(led3);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|