Last active
July 5, 2023 11:10
-
-
Save crazycoder1999/0fbbb513a26023397989a3d00c95466e to your computer and use it in GitHub Desktop.
Playing with Arduino Uno R4 Matrix: simple animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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