Skip to content

Commit dd3904d

Browse files
Merge pull request #533 from arduino/benjamindannegard/giga-display-shield-tutorial-reviews
[GIGA Display Shield] tutorial reviews
2 parents bbf1ee5 + 3cdd9bc commit dd3904d

File tree

8 files changed

+94
-14
lines changed

8 files changed

+94
-14
lines changed

content/hardware/10.mega/shields/giga-display-shield/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<FeatureDescription>
22

3-
The GIGA Display Shield has a 3.97” 480x800 RGB touch screen, a digital microphone, a 6 Axis IMU and an RGB. The shield can easily be mounted on the GIGA R1 WiFi board.
3+
The GIGA Display Shield has a 3.97” 480x800 RGB touch screen, a digital microphone, a 6 Axis IMU and an RGB LED. The shield can easily be mounted on the GIGA R1 WiFi board.
44

55
Utilizing the GIGA R1 WiFi's fast 480 MHz microcontroller, you can build powerful UIs, use interactive 3D animations, display camera feed and much more. The shield is compatible with a wide range of graphics libraries, including [LVGL](https://github.com/lvgl/lvgl), [GFX](https://github.com/bcmi-labs/Arduino_GigaDisplay_GFX/) and [ArduinoGraphics](https://github.com/arduino-libraries/ArduinoGraphics/).
66

content/hardware/10.mega/shields/giga-display-shield/tutorials/basic-draw-and-image/content.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ This is a great tutorial for getting started with your shield and exploring what
2323

2424
Make sure the latest GIGA Core is installed in the Arduino IDE. **Tools > Board > Board Manager...**. Here you need to look for the **Arduino Mbed OS Giga Boards** and install it, the [Arduino_H7_Video library](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Arduino_H7_Video) is included in the core and is needed for the examples to work. Now you have to install the library needed for the graphical display features. To do this, go to **Tools > Manage libraries..**, search for **ArduinoGraphics**, and install it.
2525

26+
For more information about libraries and how to install them with the IDE, visit our [libraries tutorial](/software/ide-v2/tutorials/ide-v2-installing-a-library).
27+
2628
## Using Draw Feature in a Sketch
2729

2830
First, we need to include the library that we will be using and define the display screen:

content/hardware/10.mega/shields/giga-display-shield/tutorials/basic-touch/basic-touch.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags: [Display, Touch Screen]
77

88
The [GIGA Display Shield](/hardware/giga-display-shield) has an advanced touch interface, supported via the [Arduino_GigaDisplayTouch](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch) library.
99

10-
This library is used to return the number of contact points, and the `x,y` coordinates for each of these. For example, touching the screen with two fingers somewhere on the screen would generate the following:
10+
This library is used to return the number of contact points, and the `x,y` coordinates for each of these. For example, touching the screen with two fingers would generate the following:
1111

1212
- `x` - 0-480 (x-axis)
1313
- `y` - 0-800 (y-axis)
@@ -17,13 +17,13 @@ This library is used to return the number of contact points, and the `x,y` coord
1717

1818
## Hardware & Software Needed
1919

20-
- [GIGA R1 WiFi](/hardware/giga-r1).
20+
- [GIGA R1 WiFi](/hardware/giga-r1-wifi).
2121
- [GIGA Display Shield](/hardware/giga-display-shield)
2222
- [Arduino IDE](https://www.arduino.cc/en/software)
2323

2424
## Install Arduino_GigaDisplayTouch
2525

26-
The [Arduino_GigaDisplayTouch](https://www.arduino.cc/reference/en/libraries/arduino_gigadisplaytouch/) is used to read touchpoints across the screen, and returns the number of **contacts** and **coordinates**.
26+
The [Arduino_GigaDisplayTouch library](https://www.arduino.cc/reference/en/libraries/arduino_gigadisplaytouch/) is used to read touchpoints across the screen, returning the number of **contacts** and **coordinates**.
2727

2828
![Install Arduino_GigaDisplayTouch](assets/install-touchlib.png)
2929

@@ -47,7 +47,7 @@ Upload the example to your GIGA R1 WiFi board, and open the **Serial Monitor** t
4747
Touch controller init - OK
4848
```
4949

50-
Seeing this, you can start touching the display area with one or more fingers. The serial monitor will print out how many "contacts" aka fingers you are using, and the coordinates for each point. Here's an example response:
50+
Seeing this, you can start touching the display area with one or more fingers. The serial monitor will print out how many "contacts",aka fingers, you are using and the coordinates for each point. Here's an example response:
5151

5252
```
5353
Contacts: 2 <---- two fingers used
@@ -57,8 +57,48 @@ Contacts: 2 <---- two fingers used
5757

5858
In this case, we have two touchpoints, and the coordinates for each of them printed below (`x`,`y`). And that's pretty much it to obtain a successful reading from the touch interface.
5959

60-
You can use this to build customised gestures on the screen such as swiping two fingers left to trigger an animation, or three fingers up to change the background color.
60+
You can use this to build customized gestures on the screen, such as swiping two fingers left to trigger an animation or three fingers up to change the background color.
61+
62+
### Full Sketch
63+
64+
```arduino
65+
#include "Arduino_GigaDisplayTouch.h"
66+
67+
Arduino_GigaDisplayTouch touchDetector;
68+
69+
void setup() {
70+
Serial.begin(115200);
71+
while(!Serial) {}
72+
73+
if (touchDetector.begin()) {
74+
Serial.print("Touch controller init - OK");
75+
} else {
76+
Serial.print("Touch controller init - FAILED");
77+
while(1) ;
78+
}
79+
}
80+
81+
void loop() {
82+
uint8_t contacts;
83+
GDTpoint_t points[5];
84+
85+
contacts = touchDetector.getTouchPoints(points);
86+
87+
if (contacts > 0) {
88+
Serial.print("Contacts: ");
89+
Serial.println(contacts);
90+
91+
for (uint8_t i = 0; i < contacts; i++) {
92+
Serial.print(points[i].x);
93+
Serial.print(" ");
94+
Serial.println(points[i].y);
95+
}
96+
}
97+
98+
delay(1);
99+
}
100+
```
61101

62102
## Summary
63103

64-
In this tutorial, we have explored the **Arduino_GigaDisplayTouch** library and tested out an example that allows us to read the coordinates of our touches. This library is essential for developing sophisticated touch displays using the lvgl framework.
104+
In this tutorial, we have explored the **Arduino_GigaDisplayTouch** library and tested out an example that allows us to read the coordinates of our touches. This library is essential for developing sophisticated touch displays using lvgl or other supported frameworks.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Connect the camera to the connector on the front of the display shield as shown
3535

3636
![Camera connected to the GIGA Display Shield](assets/camera-connected.svg)
3737

38+
***Note the direction of the shield, physically the connector can be plugged in from both directions, but it will only work when facing the same direction as the display.***
39+
3840
## Full Sketch
3941

4042
Open the example sketch by going to **File > Examples > Camera > GigaCameraDisplay** in the Arduino IDE.

content/hardware/10.mega/shields/giga-display-shield/tutorials/gfx-guide/assets/shapes-on-display.svg

Lines changed: 14 additions & 0 deletions
Loading

content/hardware/10.mega/shields/giga-display-shield/tutorials/gfx-guide/assets/text-on-display.svg

Lines changed: 14 additions & 0 deletions
Loading

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ To access it, we can use a layer library called [Arduino_GigaDisplay_GFX](https:
1313

1414
In this guide we will cover:
1515
- Learn how to draw and print to the display,
16-
- how to draw basic shapes (circles, rectangles etc)
17-
- how to update values on the screen,
16+
- How to draw basic shapes (circles, rectangles etc)
17+
- How to update values on the screen,
1818

1919
## Hardware & Software Needed
2020

21-
- [GIGA R1 WiFi](/hardware/giga-r1).
21+
- [GIGA R1 WiFi](/hardware/giga-r1-wifi).
2222
- [GIGA Display Shield](/hardware/giga-display-shield)
2323
- [Arduino IDE](https://www.arduino.cc/en/software)
2424

@@ -60,7 +60,7 @@ There are several methods available. In this section, we will list out a number
6060

6161
### Coordinates
6262

63-
The coordinates in the GFX library is easy to work with. Most methods have the coordinates as parameters (x,y). To set the cursor (position) on the display, you can utilize the following method:
63+
The coordinates in the GFX library are easy to work with. Most methods have the coordinates as parameters (x,y). To set the cursor (position) on the display, you can utilize the following method:
6464

6565
- `setCursor(x, y)` - set the cursor on the display.
6666

@@ -106,6 +106,8 @@ void setup() {
106106
void loop(){}
107107
```
108108

109+
![Text sketch running on the GIGA Display Shield](assets/text-on-display.svg)
110+
109111
### Pixels & Shapes
110112

111113
To draw pixels and shapes, use the following methods.
@@ -139,6 +141,8 @@ void setup() {
139141
void loop() {}
140142
```
141143

144+
![Shapes sketch running on the GIGA Display Shield](assets/shapes-on-display.svg)
145+
142146
## GFX & Touch Example
143147

144148
The GFX library can be used together with the [Arduino_GigaDisplay_Touch](https://github.com/arduino-libraries/Arduino_GigaDisplayTouch) library. The below example demonstrates how to read a touch point and trigger a function, using a simple if statement.

content/hardware/10.mega/shields/giga-display-shield/tutorials/image-orientation/content.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ Arduino_H7_Video Display(800, 480, GigaDisplayShield); /* Arduino_H7_Vi
3333
BoschSensorClass imu(Wire1);
3434
```
3535

36-
Start receiving IMU readings with `imu.begin();` and start the display with `Display.begin();`. Then we can assign attributes to the images such as its source, alignment and how the rotation should behave. For more information on image attributes with LVGL, check out our [LVGL tutorial](lvgl-guide#image).
36+
Start receiving IMU readings with `imu.begin();` and start the display with `Display.begin();`.
37+
38+
Then we can assign attributes to the images such as its source, alignment and how the rotation should behave. For more information on image attributes with LVGL, check out our [LVGL tutorial](lvgl-guide#image).
3739

3840
```arduino
3941
LV_IMG_DECLARE(img_arduinologo);
@@ -52,7 +54,9 @@ void setup() {
5254
}
5355
```
5456

55-
Now all that is left is to change the image depending on the IMU readings. First, declare the variables that will hold the values. Then to assign them the IMU reading values use `imu.readAcceleration(x, y, z);`. Next, we use `if ()` statements to change the rotation variable depending on the readings we are getting. And at the end, we render the image with the correct rotation. When the correct rotation has been calculated, we can apply it to the image using `lv_img_set_angle(img, rot_angle);`.
57+
Now all that is left is to change the image depending on the IMU readings. First, declare the variables that will hold the values. Then to assign them the IMU reading values use `imu.readAcceleration(x, y, z);`.
58+
59+
Next, we use `if ()` statements to change the rotation variable depending on the readings we are getting. And at the end, we render the image with the correct rotation. When the correct rotation has been calculated, we can apply it to the image using `lv_img_set_angle(img, rot_angle);`.
5660

5761
```arduino
5862
uint8_t rotation = 0;
@@ -160,7 +164,7 @@ void loop() {
160164

161165
### Using Another Image
162166

163-
Any image could be the sketch. This tutorial and the example uses an image of the Arduino logo. Alternatively, any raw RGB565 image can be used. If you have an image you want to use, you can use this [online image converter](https://lvgl.io/tools/imageconverter), or any other software that lets you convert an image to a raw RGB565 image. This website will output in the Binary RGB565 format. For further instructions on how to display your own image, have a look at our [Text and Image tutorial](text-and-image).
167+
Any image could be used in the sketch. This tutorial and the example uses an image of the Arduino logo. Alternatively, any raw RGB565 image can be used. If you have an image you want to use, you can use this [online image converter](https://lvgl.io/tools/imageconverter), or any other software that lets you convert an image to a raw RGB565 image. This website will output in the Binary RGB565 format. For further instructions on how to display your own image, have a look at our [Text and Image tutorial](text-and-image).
164168

165169
## Testing It Out
166170

0 commit comments

Comments
 (0)