One of the interesting features of the Arduino UNO R4 WiFi is that it has a built-in 12×8 LED Matrix. Using a bit of creativity you can display anything you want on this.
There is a handy led matrix editor online where you can create your animations, link is at the bottom of this article
To use the LED Matrix library, there are a couple of things that you will need to add to your sketch
First, include the library at the top of your sketch, like this:
#include "Arduino_LED_Matrix.h"
Then, you need to create a LED Matrix object in your sketch, by adding the following line directly underneath the first one
ArduinoLEDMatrix matrix;
And then lastly, you start the LED Matrix by adding this line in void setup():
matrix.begin();
So a basic framework would be
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
void setup()
{
matrix.begin();
}
void loop() {
}
Now let’s look at 2 examples that you can try, both use slightly different ways to light the less and display animations
Code examples
Example 1
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
void setup()
{
matrix.begin();
}
uint8_t frame[8][12] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
void corners()
{
frame[0][0] = 1;
frame[0][11] = 1;
frame[7][0] = 1;
frame[7][11] = 1;
}
void centre()
{
frame[3][5] = 1;
frame[3][6] = 1;
frame[4][5] = 1;
frame[4][6] = 1;
}
void clearmatrix()
{
frame[0][0] = 0;
frame[0][11] = 0;
frame[7][0] = 0;
frame[7][11] = 0;
frame[3][5] = 0;
frame[3][6] = 0;
frame[4][5] = 0;
frame[4][6] = 0;
}
void loop()
{
corners();
matrix.renderBitmap(frame, 8, 12);
delay(1000);
centre();
matrix.renderBitmap(frame, 8, 12);
delay(1000);
clearmatrix();
matrix.renderBitmap(frame, 8, 12);
delay(1000);
}
Example 2
#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;
const uint32_t frame1[] = {
0xfff80180,
0x18018018,
0x1801fff,
66
};
const uint32_t frame2[] = {
0x7fe40,
0x24024024,
0x27fe000,
66
};
const uint32_t frame3[] = {
0x3f,
0xc2042043,
0xfc000000,
66
};
const uint32_t frame4[] = {
0x0,
0x1f81f80,
0x0,
66
};
void setup()
{
matrix.begin();
}
void loop() {
matrix.loadFrame(frame1);
delay(500);
matrix.loadFrame(frame2);
delay(500);
matrix.loadFrame(frame3);
delay(500);
matrix.loadFrame(frame4);
delay(500);
}
Link
https://ledmatrix-editor.arduino.cc/
https://github.com/programmershelp/Arduino/tree/main/R4%20Examples/matrixexample1
https://github.com/programmershelp/Arduino/tree/main/R4%20Examples/matrixexample2

