|
1 | 1 | ---
|
2 |
| -title: "Using the Arduino UNO R4 WiFi LED Matrix" |
3 |
| -description: "Get off the ground with the Arduino UNO R4 WiFi built-in LED matrix. Learn the different techniques for controlling it, create animations, graphics or even games." |
| 2 | +title: 'Using the Arduino UNO R4 WiFi LED Matrix' |
| 3 | +description: 'Get off the ground with the Arduino UNO R4 WiFi built-in LED matrix. Learn the different techniques for controlling it, create animations, graphics or even games.' |
4 | 4 | tags:
|
5 | 5 | - Guide
|
6 | 6 | - LED Matrix
|
@@ -283,11 +283,54 @@ The LED Matrix now supports printing characters via the [ArduinoGraphics](https:
|
283 | 283 | - Set a start location for the text via `matrix.beginText(x,y, 0xFFFFFF)`. The "0xFFFFFF" represents the default color (red). As the **ArduinoGraphics** library supports other hardware with multiple colors, we need to specify it.
|
284 | 284 | - Print the text via `matrix.printText("This message is printed")`
|
285 | 285 | - End the print and (optionally) specify scroll direction with `matrix.endText(direction)`
|
286 |
| - - `SCROLL_LEFT`, `SCROLL_RIGHT` are supported. Leave blank if no scroll is desired. |
| 286 | +- `SCROLL_LEFT`, `SCROLL_RIGHT` are supported. Leave blank if no scroll is desired. |
287 | 287 |
|
288 | 288 | The example below simply prints out **"Hello World!"** on the matrix.
|
289 | 289 |
|
290 |
| -<CodeBlock url="https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/Arduino_LED_Matrix/examples/TextWithArduinoGraphics/TextWithArduinoGraphics.ino" className="arduino"/> |
| 290 | +```arduino |
| 291 | +// To use ArduinoGraphics APIs, please include BEFORE Arduino_LED_Matrix |
| 292 | +#include "ArduinoGraphics.h" |
| 293 | +#include "Arduino_LED_Matrix.h" |
| 294 | +
|
| 295 | +ArduinoLEDMatrix matrix; |
| 296 | +
|
| 297 | +void setup() { |
| 298 | + Serial.begin(115200); |
| 299 | + matrix.begin(); |
| 300 | +
|
| 301 | + matrix.beginDraw(); |
| 302 | + matrix.stroke(0xFFFFFFFF); |
| 303 | + // add some static text |
| 304 | + // will only show "UNO" (not enough space on the display) |
| 305 | + const char text[] = "UNO r4"; |
| 306 | + matrix.textFont(Font_4x6); |
| 307 | + matrix.beginText(0, 1, 0xFFFFFF); |
| 308 | + matrix.println(text); |
| 309 | + matrix.endText(); |
| 310 | +
|
| 311 | + matrix.endDraw(); |
| 312 | +
|
| 313 | + delay(2000); |
| 314 | +} |
| 315 | +
|
| 316 | +void loop() { |
| 317 | +
|
| 318 | + // Make it scroll! |
| 319 | + matrix.beginDraw(); |
| 320 | +
|
| 321 | + matrix.stroke(0xFFFFFFFF); |
| 322 | + matrix.textScrollSpeed(50); |
| 323 | +
|
| 324 | + // add the text |
| 325 | + const char text[] = " Hello World! "; |
| 326 | + matrix.textFont(Font_5x7); |
| 327 | + matrix.beginText(0, 1, 0xFFFFFF); |
| 328 | + matrix.println(text); |
| 329 | + matrix.endText(SCROLL_LEFT); |
| 330 | +
|
| 331 | + matrix.endDraw(); |
| 332 | +} |
| 333 | +``` |
291 | 334 |
|
292 | 335 | ## Animation Generation
|
293 | 336 | We have developed a tool that is used to generate frames and animations to be rendered on the LED Matrix in your browser. This tool is part of [Arduino labs](https://labs.arduino.cc), and is therefore considered experimental software.
|
|
0 commit comments