You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/10.mega/shields/giga-display-shield/tutorials/draw-and-image/content.md
+72-3Lines changed: 72 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This is a great tutorial for getting started with your shield and exploring what
18
18
19
19
## Downloading the Library and Core
20
20
21
-
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. 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.
21
+
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. 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.
22
22
23
23
## Using Draw Feature in a Sketch
24
24
@@ -81,7 +81,7 @@ Now that the drawing is done the `Display.endDraw()` function can be called.
81
81
}
82
82
```
83
83
84
-
The complete code can be found as an example in the **Arduino_H7_video** library, it is called **ArduinoLogoDrawing**. Now upload the entire sketch and you should see the Arduino logo being drawn on the display.
84
+
The complete code can be found as an example in the **Arduino_H7_video** library, it is called **ArduinoLogoDrawing**. The full sketch is also below. Now upload the entire sketch and you should see the Arduino logo being drawn on the display.
85
85
86
86
### Full Sketch
87
87
@@ -119,12 +119,81 @@ void loop() { }
119
119
120
120
```
121
121
122
-
## Testing It Out
122
+
###Testing It Out
123
123
124
124
Now that it is all uploaded your GIGA Display Shield should look like the image below:
125
125
126
126

127
127
128
+
## Displaying Images
129
+
130
+
Now let's have a look at how we can use the **ArduinoGraphics** library to display images on the GIGA Display Shield.
131
+
132
+
### Converting an Image
133
+
134
+
Using an online image converter you can pick any image you would like to be displayed on the display shield. However keep in mind the display is 480x800 in size. The format of the converted image needs to be Binary RGB565. Using an online image converter like the [LVGL image converter tool](https://lvgl.io/tools/imageconverter) will let you pick this as an option. Simply pick the "Binary RGB565" option under "Output format", your desired color format and hit "Convert". You will now have an image that is ready for use in an Arduino sketch.
135
+
136
+
### Displaying the Image on the Display
137
+
138
+
We will be using the example sketch "ArduinoLogo" as the basis for the sketch that lets us display an image. The example sketch can be found under **File->Examples->Arduino_H7_Video->ArduinoLogo**.
139
+
140
+
Running the example sketch as is will display the Arduino logo on the screen, like in the image below:
141
+
142
+
[Arduino Logo on the GIGA Display Shield]()
143
+
144
+
Now to use the image that we converted in the last step. Use the macro inside the example sketch. This makes use of the `incbin.h` translation library. The necessary files are located in the folder for the example sketch.
145
+
146
+
At the start of the sketch you can see these lines commented out:
147
+
```arduino
148
+
/*
149
+
#define INCBIN_PREFIX
150
+
#include "incbin.h"
151
+
INCBIN(test, "/home/user/Downloads/test.bin");
152
+
*/
153
+
```
154
+
155
+
Uncomment these lines, and change the path to the image to the correct one. For Mac and Linux users the syntax of the path is correct as `"/home/user/Downloads/test.bin"`. For Windows users the path needs to be an absolute path, like this: `"C:\USERNAME\Downloads\test.bin"`. Now we need to change the `Image` variable to use our image.
156
+
157
+
By default the image we import will be called `test`. The line `Image img_arduinologo(ENCODING_RGB16, (uint8_t *) texture_raw, 300, 300);` needs to have one argument changed, `texture_raw` should now be `testData`. So the line should be `Image img_arduinologo(ENCODING_RGB16, (uint8_t *) testData, 300, 300);`.
158
+
159
+
160
+
### Full Sketch
161
+
162
+
```arduino
163
+
/*
164
+
ArduinoLogo
165
+
166
+
created 17 Apr 2023
167
+
by Leonardo Cavagnis
168
+
*/
169
+
170
+
#include "Arduino_H7_Video.h"
171
+
#include "ArduinoGraphics.h"
172
+
173
+
#include "img_arduinologo.h"
174
+
// Alternatively, any raw RGB565 image can be included on demand using this macro
0 commit comments