Update bar value periodically

How would I go about implementing the ability for an lv_bar to set its value to a number 0-100 every 3 seconds and have it be updated to the screen as the value changes?

In your code, you should write something like this:

void update_progress_bar(int value) {

    // Update the progress bar value
    lv_bar_set_value(progress_bar, value, LV_ANIM_ON);

You would then run update_progress_bar() in a endless loop (for bare metal) or in a task (in a RTOS).


// The function of delay is specific on the software framework you are using
delay(3000); // delay for three seconds
1 Like