matrice-led.ino
The 12x8 matrix is the R4 WiFi signature: this script draws a ball bouncing diagonally, frame by frame. The official ArduinoLEDMatrix library hides the row multiplexing and the internal WS2812 driver.
Hardware
An Arduino UNO R4 WiFi (Renesas RA4M1 @ 14 MHz + companion ESP32-S3 Wi-Fi/BLE, 12x8 LED matrix, RGB LED) powered by USB or 6-24 V. None: the matrix is built into the board.
Wiring
Nothing to wire. The matrix draws up to ~100 mA: power over USB rather than a pin.
How it works
Each image is an 8-byte array (1 bit = 1 LED); setFrame loads it, render displays it. The loop moves the ball and flips the slope at the edges.
Running it
Arduino IDE 2.x with the « Arduino UNO R4 Boards » core, « Arduino UNO R4 WiFi » board, serial port then Upload. The ESP32-S3 coprocessor updates separately if the IDE asks.
Variants
Show scrolling text (5x7 bitmap per character), or a network visualizer driven over Wi-Fi.
matrice-led.ino
// Matrice 12x8 du R4 WiFi via la bibliotheque officielle.
#include "ArduinoLEDMatrix.h"
ArduinoLEDMatrix matrice;
// Trame : 8 octets, 1 bit = 1 LED (12 colonnes utilisees).
#include <string.h>
uint8_t frame[8] = {0};
void setup() {
matrice.begin();
matrice.setBrightness(10);
Serial.begin(9600);
}
void loop() {
static unsigned long t0 = 0;
if (millis() - t0 < 120) return;
t0 = millis();
static int x = 0;
memset(frame, 0, sizeof(frame));
// Une balle qui rebondit en diagonale.
static int y = 0, dy = 1;
int col = x % 12;
frame[y] |= (1 << col);
frame[y] |= (1 << ((col + 1) % 12)); // petite trainee
x = (x + 1) % 12;
y += dy;
if (y == 0 || y == 7) dy = -dy;
matrice.setFrame(frame);
matrice.render();
}
// La bibliotheque est livree avec le core UNO R4 (Arduino IDE).