Skip to content

Commit bca1989

Browse files
Merge pull request #1490 from arduino/benjamindannegard/display-shield-tutorial-updates
[GIGA Display Shield] Added text sections to tutorials
2 parents 2889378 + d98b195 commit bca1989

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

content/hardware/10.mega/shields/giga-display-shield/tutorials/03.lvgl-guide/assets/lv_config.svg

Lines changed: 27 additions & 0 deletions
Loading

content/hardware/10.mega/shields/giga-display-shield/tutorials/03.lvgl-guide/content.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,30 @@ void loop() {
273273
}
274274
```
275275

276+
### Text
277+
278+
Displaying text is usually done with labels. These are used in most of the other examples to put text on buttons and switches. Like any other element you first have to create the object with:
279+
280+
```arduino
281+
lv_obj_t * label;
282+
```
283+
284+
Then the labels text can be set with:
285+
```arduino
286+
lv_label_set_text(label, "Label!");
287+
```
288+
289+
If you want to insert a variable that is not a string, use:
290+
291+
```arduino
292+
//This will make the label show the number 13
293+
lv_label_set_text_fmt(label, "%d", 13)
294+
```
295+
296+
To use bigger font sizes it has to be enabled in the `lv_conf.h` file. This file can be found in the **mbed_giga/libraries/Arduino_H7_Video/src** folder. Find the **FONT USAGE** section, here you can see all the font sizes. If you want to enable any size simply change the `0` next to any of the font sizes into a `1`. Like this:
297+
298+
![lv_config font section](assets/lv_config.svg)
299+
276300
## Functional Elements
277301

278302
### Checkbox

content/hardware/10.mega/shields/giga-display-shield/tutorials/10.square-line-tutorial/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Name the widgets accordingly:
9898
- **Decrease Button**: ui_ButtonDec
9999
- **Number Label**: ui_LabelNum
100100

101-
Also pay attention to the size of the font set for the counter label. We set the size to 26, this then needs to be enabled in the lv_conf.h file. This file can be found in /mbed/libraries/Arduino_H7_Video/src.
101+
Also pay attention to the size of the font set for the counter label. We set the size to 26, this then needs to be enabled in the lv_conf.h file. This file can be found in the **mbed_giga/libraries/Arduino_H7_Video/src** folder.
102102

103103
![Font size option in SquareLine Studio](assets/text_font_size.png)
104104

0 commit comments

Comments
 (0)