#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#define PIN 3 // Data pin connected to RGB matrix
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
32, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800
);
void setup() {
matrix.begin();
matrix.setBrightness(40);
}
void loop() {
animation1(); delay(2000);
animation2(); delay(2000);
animation3(); delay(2000);
animation4(); delay(2000);
animation5(); delay(2000);
}
// --- Animation 1: Rainbow fill ---
void animation1() {
for (int x = 0; x < 32; x++) {
for (int y = 0; y < 8; y++) {
uint16_t color = matrix.Color((x*8)%255, (y*32)%255, ((x+y)*16)%255);
matrix.drawPixel(x, y, color);
}
}
matrix.show();
}
// --- Animation 2: Moving vertical bar ---
void animation2() {
for (int pos = 0; pos < 32; pos++) {
matrix.fillScreen(0);
for (int y = 0; y < 8; y++) {
matrix.drawPixel(pos, y, matrix.Color(255, 0, 0));
}
matrix.show();
delay(50);
}
}
// --- Animation 3: Checkerboard flash ---
void animation3() {
for (int t = 0; t < 6; t++) {
matrix.fillScreen(0);
for (int x = 0; x < 32; x++) {
for (int y = 0; y < 8; y++) {
if ((x+y+t) % 2 == 0) {
matrix.drawPixel(x, y, matrix.Color(0, 255, 0));
}
}
}
matrix.show();
delay(300);
}
}
// --- Animation 4: Horizontal wave ---
void animation4() {
for (int phase = 0; phase < 32; phase++) {
matrix.fillScreen(0);
for (int x = 0; x < 32; x++) {
int y = (sin((x+phase) * 0.3) * 3.5) + 4; // wave pattern
matrix.drawPixel(x, y, matrix.Color(0, 0, 255));
}
matrix.show();
delay(80);
}
}
// --- Animation 5: Expanding box ---
void animation5() {
for (int size = 1; size <= 8; size++) {
matrix.fillScreen(0);
matrix.drawRect((32-size*4)/2, (8-size)/2, size*4, size, matrix.Color(255, 255, 0));
matrix.show();
delay(200);
}
}FPS: 0
Power: 0.00W
Power: 0.00W