|
1 | 1 | ---
|
2 |
| -title: "Using the Arduino UNO R4 WiFi LED Matrix" |
3 |
| -description: "Get off the ground with the Arduino UNO R4 WiFi's 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
|
@@ -276,7 +276,62 @@ matrix.renderBitmap(frame, 8, 12);
|
276 | 276 | delay(1000);
|
277 | 277 | }
|
278 | 278 | ```
|
279 |
| - |
| 279 | + |
| 280 | +## Scrolling Text Example |
| 281 | + |
| 282 | +The LED Matrix now supports printing characters via the [ArduinoGraphics](https://github.com/arduino-libraries/ArduinoGraphics) library. With it, you are able to: |
| 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 | +- Print the text via `matrix.printText("This message is printed")` |
| 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. |
| 287 | + |
| 288 | +The example below simply prints out **"Hello World!"** on the matrix. |
| 289 | + |
| 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 | +``` |
| 334 | + |
280 | 335 | ## Animation Generation
|
281 | 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.
|
282 | 337 |
|
@@ -311,7 +366,7 @@ void loop() {
|
311 | 366 | [Click here](https://ledmatrix-editor.arduino.cc) to go to the LED Matrix tool.
|
312 | 367 |
|
313 | 368 |
|
314 |
| - |
| 369 | + |
315 | 370 |
|
316 | 371 | Once you've made your animations, you can export them from the tool in the format that lets you use them like [previously discussed](#how-to-write-a-frame).
|
317 | 372 |
|
|
0 commit comments