Skip to content

Commit a7f6849

Browse files
committed
Update led-matrix.md
1 parent cfe4312 commit a7f6849

File tree

1 file changed

+47
-4
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix

1 file changed

+47
-4
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix/led-matrix.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
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.'
44
tags:
55
- Guide
66
- LED Matrix
@@ -283,11 +283,54 @@ The LED Matrix now supports printing characters via the [ArduinoGraphics](https:
283283
- 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.
284284
- Print the text via `matrix.printText("This message is printed")`
285285
- 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.
287287

288288
The example below simply prints out **"Hello World!"** on the matrix.
289289

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+
```
291334

292335
## Animation Generation
293336
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

Comments
 (0)