breadboard
docs

Example project · Displays

Uno R4 · scrolling matrix text

ArduinoGraphics scrolls HI across the real 12×8 matrix in 50 ms steps. Edit the text or scroll speed in Code. Recompiling requires the pinned ArduinoGraphics 1.1.5 library.

The Uno R4 · scrolling matrix text circuit as rendered by the simulator

How it works

This sketch adds the ArduinoGraphics library on top of Arduino_LED_Matrix, so the 12 × 8 matrix can be used like a small screen with fonts and text. Each pass of loop() opens a drawing frame with beginDraw(), sets the stroke colour, picks the built-in 5 × 7 font and sets a scroll speed of 50 ms per step. beginText(0, 1, 0xFFFFFF) starts the text one row down, so the 7-pixel letters sit inside the 8 rows.

The message has a space on each side of HI. endText(SCROLL_LEFT) starts the string at column 0 and shifts it left one column at a time until it clears the display. Then loop() starts again, so the message repeats without a pause.

What to watch

HI moves from right to left across the matrix, one column every 50 ms, and starts again once it has gone. The library is pinned to ArduinoGraphics 1.1.5, so a rebuild uses the same drawing code as the bundled firmware.

What's on the bench

  • Arduino Uno R4

The code

This Arduino C++ sketch lives in Code; sign in and press Compile & upload to build real firmware for the emulated board.

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
}

void loop() {
  matrix.beginDraw();
  matrix.stroke(0xFFFFFFFF);
  matrix.textScrollSpeed(50);
  matrix.textFont(Font_5x7);
  matrix.beginText(0, 1, 0xFFFFFF);
  matrix.print(" HI ");
  matrix.endText(SCROLL_LEFT);
  matrix.endDraw();
}

Firmware licence

Notice: this firmware uses the LGPL-licensed Arduino core library

arduino-unor4wifi-matrix-scroll.bin is statically linked with ArduinoCore-renesas 1.6.0, in Breadboard's port of its UNO R4 WiFi variant to Renesas FSP 5.3.0. Parts of that core are licensed under the GNU Lesser General Public License, version 2.1 or (at your option) any later version ("the Library"). Breadboard distributes this firmware under terms that permit you to modify the work for your own use and to reverse engineer it for debugging such modifications.

Try this

  • Replace HI in matrix.print with a longer message and press Compile & upload. Longer text takes longer to cross the matrix.
  • Set textScrollSpeed(100) for a slower scroll or textScrollSpeed(20) for a faster one.
  • Use SCROLL_RIGHT in endText to send the text the other way.

Related projects