Skip to content

Marqdevx/lvgl 1st tutorial #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions examples/Creating GUIs with LVGL/lvglCounter/lvglCounter.ino
Original file line number Diff line number Diff line change
@@ -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();
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
sentence=This library contains the complete Arduino sketches from the Pro Tutorials.
Expand Down