Skip to content

Commit 2e4fcf7

Browse files
authored
Merge pull request #15 from arduino-libraries/marqdevx/lvgl-1stTutorial
* Added sketch from the lvgl tutorial https://docs.arduino.cc/tutorials/portenta-h7/por-ard-lvgl
2 parents 55f916e + d9f4e63 commit 2e4fcf7

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

Diff for: .github/workflows/compile-examples.yml

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
sketch-paths: |
4040
- examples/BLE Connectivity on Portenta H7/PortentaBLE
4141
- examples/Creating a Flash-Optimised Key-Value Store/FlashKeyValue
42+
- examples/Creating GUIs with LVGL/lvglCounter
4243
- examples/Dual Core Processing/BlinkRedLed
4344
- examples/Dual Core Processing/BlinkRedLed_M7
4445
- examples/Portenta H7 as a USB Host/LEDKeyboardController
@@ -67,6 +68,8 @@ jobs:
6768
# Install library dependencies.
6869
- name: ArduinoBLE
6970
- name: Arduino_EdgeControl
71+
- name: lvgl
72+
version: 7.11.0
7073
7174
sketch-paths: |
7275
# Sketches to compile for all boards
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Using LVGL v7.11
3+
*/
4+
5+
#include "Portenta_LittleVGL.h"
6+
7+
static lv_obj_t *label;
8+
int counter = 0;
9+
10+
static void updateCounterTask(lv_task_t *task) {
11+
// Print the count to the Serial monitor
12+
Serial.println(counter);
13+
14+
// Update the text of the label
15+
lv_label_set_text_fmt(label, "%d" , counter);
16+
17+
// Increase the count number
18+
counter++;
19+
}
20+
21+
void setup() {
22+
Serial.begin(9600);
23+
24+
// Initialize Portenta's video interface
25+
portenta_init_video();
26+
27+
// Setting up the label making it a child of the screen
28+
label = lv_label_create(lv_scr_act(), NULL);
29+
30+
// Set the label's text
31+
lv_label_set_text(label , "Counter");
32+
33+
// We move it to the center of the screen and align it centered
34+
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
35+
36+
// Create a task to update the counter
37+
lv_task_create(updateCounterTask, 1000, LV_TASK_PRIO_MID, NULL);
38+
}
39+
40+
void loop() {
41+
// put your main code here, to run repeatedly:
42+
lv_task_handler();
43+
}

Diff for: library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Arduino_Pro_Tutorials
2-
version=1.0.3
2+
version=1.0.4
33
author=Martino Facchin, Riccardo Ricco, Dario Pennisi, Sebastian Romero, Lenard George, Ignacio Herrera, Jose García, Pablo Marquínez
44
maintainer=Arduino <[email protected]>
55
sentence=This library contains the complete Arduino sketches from the Pro Tutorials.

0 commit comments

Comments
 (0)