Description Displaying sensor readings in a table or label object.
What MCU/Processor/Board and compiler are you using? ESP32 Wroom Devkit C and Arduino IDE
What do you want to achieve?
I am reading temperature, weight and humidity from sensors and save the read values in float variables.
I would like to display the values of these variables in a label or better in a table object.
But as far as I understand i just can use char variables for the set cell value function :
This is from the example
lv_table_set_cell_value(table, 2, 0, âBananaâ);
I hope that this question is not to noobish but I just have started ESP32 programming a month ago and donât know how solve this.
I would be really happ if somebody can push me to the right direction.
What have you tried so far?
I managed to to define a char variable for testing purposes and the value of this variable is shown on the display. But a char is not enough so i would like to show the value of an float variable.
But i canât find out how to make littlevGL to use a float ( or a float converted to a string) for a table or a label object.
Code to reproduce
This is a slightly modified version of the example from the documentation for a table. It reads the value of the test char variable and shows it on my screen.
It works and shows me the value of the variable âtestâ on my display.
/* const char test = '9' ;
/*Fill the first column*/
lv_table_set_cell_value(table, 0, 0, "Name");
lv_table_set_cell_value(table, 1, 0, &test );
lv_table_set_cell_value(table, 2, 0, "Banana");
lv_table_set_cell_value(table, 3, 0, "Citron");
*/
Code to reproduce
This is version where I am trying to convert a float into a string and make LittlevGL to show me the value of the float/string in a table
float test = 12.4;
String test2;
test2 = String(test);
/*Fill the first column*/
lv_table_set_cell_value(table, 0, 0, "Name");
lv_table_set_cell_value(table, 1, 0, &test2 );
lv_table_set_cell_value(table, 2, 0, "Banana");
lv_table_set_cell_value(table, 3, 0, "Citron");
*/
But this leads to a compiler error :
cannot convert âString*â to âconst char*â