LVGL Help

Hi, I am trying to display sensor data without using the standard PROS display. How should I do this?

I really just want a black background with text.

If you are using LVGL, this is the way to use labels (the main way of sending text to the screen) with sensor data and not just the basic hard-coded const char variables (I believe they’re called this).

static char buffer[32]; //for updating the gyroscope's label.
double gyroheading;
lv_obj_t * gyrovalue; //label


gyrovalue = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(gyrovalue, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 40);

gyroheading = gyro.get_heading();
snprintf(buffer, 32, "Gv: %.2f", gyroheading);


lv_label_set_text(gyrovalue, buffer);


I might have missed a line or something, but my code is pretty spread out throughout functions so I can’t really remember if I have everything. I think that’s it. Hopefully you can pick up the pieces, the buffer thing is the main (valuable) part that took me forever to discover how to do.

5 Likes

You might find good leads on this thread. If you just want to print sensor values, LLEMU is already set up and works very well.

3 Likes

Forgot about that…