diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 5e5bfa8..471d753 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -39,6 +39,7 @@ jobs: sketch-paths: | - examples/BLE Connectivity on Portenta H7/PortentaBLE - examples/Creating a Flash-Optimised Key-Value Store/FlashKeyValue + - examples/Creating GUIs with LVGL/lvglCounter - examples/Dual Core Processing/BlinkRedLed - examples/Dual Core Processing/BlinkRedLed_M7 - examples/Portenta H7 as a USB Host/LEDKeyboardController @@ -67,6 +68,8 @@ jobs: # Install library dependencies. - name: ArduinoBLE - name: Arduino_EdgeControl + - name: lvgl + version: 7.11.0 sketch-paths: | # Sketches to compile for all boards diff --git a/examples/Creating GUIs with LVGL/lvglCounter/lvglCounter.ino b/examples/Creating GUIs with LVGL/lvglCounter/lvglCounter.ino new file mode 100644 index 0000000..0f0a7e0 --- /dev/null +++ b/examples/Creating GUIs with LVGL/lvglCounter/lvglCounter.ino @@ -0,0 +1,43 @@ +/* + Using LVGL v7.11 +*/ + +#include "Portenta_LittleVGL.h" + +static lv_obj_t *label; +int counter = 0; + +static void updateCounterTask(lv_task_t *task) { + // Print the count to the Serial monitor + Serial.println(counter); + + // Update the text of the label + lv_label_set_text_fmt(label, "%d" , counter); + + // Increase the count number + counter++; +} + +void setup() { + Serial.begin(9600); + + // Initialize Portenta's video interface + portenta_init_video(); + + // Setting up the label making it a child of the screen + label = lv_label_create(lv_scr_act(), NULL); + + // Set the label's text + lv_label_set_text(label , "Counter"); + + // We move it to the center of the screen and align it centered + lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); + + // Create a task to update the counter + lv_task_create(updateCounterTask, 1000, LV_TASK_PRIO_MID, NULL); +} + +void loop() { + // put your main code here, to run repeatedly: + lv_task_handler(); +} \ No newline at end of file diff --git a/library.properties b/library.properties index 9741b06..6237097 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_Pro_Tutorials -version=1.0.3 +version=1.0.4 author=Martino Facchin, Riccardo Ricco, Dario Pennisi, Sebastian Romero, Lenard George, Ignacio Herrera, Jose García, Pablo Marquínez maintainer=Arduino sentence=This library contains the complete Arduino sketches from the Pro Tutorials.