PROS printing gyroscope value

Anyone have success with printing/updating a label on the brain screen in real time using LVGL?? I haven’t been able to make any progress on this, and there doesn’t seem to be any function for it in the version of LVGL supported by PROS. I just want to be able to print the heading of my gyroscope and other data to the screen. It would be much more useful than trying to debug things with the terminal. I’m pretty sure LLEMU can print text to the screen but I also thought it couldn’t run in tandem with LVGL.

Could you send your current LVGL code?

I don’t really have any in the sense that I know how to use the label system and everything, but I just don’t know how to format things into the label when setting the text. There is a command called set_text_fmt in the LVGL docs, but when I look into the label class in the includes of my project, the command isn’t there. It must be too new to have been included. I just need to know if anyone has a solution for this. Again, my program is not broken, because I don’t have any idea how to approach this issue.

iirc PROS uses LVGL 5.3 and the LVGL website doesn’t have the documentation readily available for you to read. However they are still all available to download Link.

Some stuff like images and demos probably won’t work.

Yes, see below

Where are you looking?

LLEMU uses LVGL However it’s already a binary in PROS projects so users cannot accidentally tamper with it. You can display your own LVGL code if as long as LLEMU is not initialized. See the post above for a copy of the 5.3 docs that are used in PROS. You should know that they are significantly different from the current v6 and v7 docs on the LVGL website.

1 Like

Thanks @_Colossus. I guess I wasn’t specific enough when explaining my problem. It is probably just a lack of programming knowledge on my part. I have looked through the 5.3 docs for LVGL and the issue is that I cannot figure out how to print label text that isn’t static (in the sense that you have to set the label text in the code manually). Basically what I want to do is update the label text in real time based on sensor values, and I’ve either missed the part of the docs where it explains how or it isn’t possible.

Also thank you for explaining the relationship between LVGL and LLEMU.

Basically I want to be able to do what they are doing in this video where they display the coordinates of the robot from the odometry and update it in real time. That is what I can’t figure out how to do. I can’t find any sample code for it otherwise I would just learn it from that.

1 Like

Well I figured out something that works from an example I dug up in this code:

Basically all I had to do was this:

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

static char buffer[32];

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

I’m not completely sure of how that buffer system works. Can anyone explain it?

Since lv_label_set_text() doesn’t allow you to use string formatting. From my understanding you use snprintf() to saves the formatted string in a char array (just a string) which is the buffer (basically a temporary store of data). Then you pass that preformatted string to the label.