Skip to content

Instantly share code, notes, and snippets.

@crazycoder1999
Last active July 5, 2023 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazycoder1999/0fbbb513a26023397989a3d00c95466e to your computer and use it in GitHub Desktop.
Save crazycoder1999/0fbbb513a26023397989a3d00c95466e to your computer and use it in GitHub Desktop.
Playing with Arduino Uno R4 Matrix: simple animation
#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 }
};
uint8_t row = 0;
uint8_t col = 0;
void loop() {
frame[row][col] = 1;
matrix.renderBitmap(frame, 8, 12);
delay(150);
frame[row][col] = 0;
matrix.renderBitmap(frame, 8, 12);
delay(50);
row++;
if (frame[row][col] == 1) {
frame[row-1][col] = 1;
if (row - 1 == 0) {
col++;
}
row = 0;
}
if (row >= 8) {
frame[row-1][col] = 1;
row = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment