init Files
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_OBSERVER && LV_USE_SLIDER && LV_USE_LABEL && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_subject_t temperature_subject;
|
||||
|
||||
/**
|
||||
* A slider sends a message on value change and a label display's that value
|
||||
*/
|
||||
void lv_example_observer_1(void)
|
||||
{
|
||||
lv_subject_init_int(&temperature_subject, 28);
|
||||
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
||||
lv_obj_center(slider);
|
||||
lv_slider_bind_value(slider, &temperature_subject);
|
||||
|
||||
/*Create a label below the slider*/
|
||||
lv_obj_t * label = lv_label_create(lv_screen_active());
|
||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 30);
|
||||
lv_label_bind_text(label, &temperature_subject, "%d °C");
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user