#include "LedControl.h"
// Pin configuration for the MAX7219 driver
const int DIN_PIN = 11; // Data in
const int CS_PIN = 10; // Chip select
const int CLK_PIN = 13; // Clock
LedControl lc = LedControl(DIN_PIN, CLK_PIN, CS_PIN, 1);
// Define patterns for the English alphabet (capital letters A to Z)
byte alphabetPatterns[][8] = {
// A
{
B00111100,
B01000010,
B10000001,
B11111111,
B10000001,
B10000001,
B10000001,
B10000001
},
// B
{
B11111110,
B10000001,
B10000001,
B11111110,
B10000001,
B10000001,
B10000001,
B11111110
},
// C
{
B01111110,
B10000001,
B10000000,
B10000000,
B10000000,
B10000001,
B10000001,
B01111110
},
// D
{
B11111100,
B10000010,
B10000001,
B10000001,
B10000001,
B10000001,
B10000010,
B11111100
},
// E
{
B11111111,
B10000000,
B10000000,
B11111111,
B10000000,
B10000000,
B10000000,
B11111111
},
// F
{
B11111111,
B10000000,
B10000000,
B11111111,
B10000000,
B10000000,
B10000000,
B10000000
},
// G
{
B01111110,
B10000001,
B10000000,
B10000000,
B10001111,
B10000001,
B10000001,
B01111110
},
// H
{
B10000001,
B10000001,
B10000001,
B11111111,
B10000001,
B10000001,
B10000001,
B10000001
},
// I
{
B01111110,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000,
B01111110
},
// J
{
B00000011,
B00000011,
B00000011,
B00000011,
B10000011,
B10000011,
B10001110,
B01110000
},
// K
{
B10000001,
B10000010,
B10000100,
B11111000,
B10011000,
B10000100,
B10000010,
B10000001
},
// L
{
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
B11111111
},
// M
{
B10000001,
B11000011,
B10100101,
B10011001,
B10000001,
B10000001,
B10000001,
B10000001
},
// N
{
B10000001,
B11000001,
B10100001,
B10010001,
B10001001,
B10000101,
B10000011,
B10000001
},
// O
{
B01111110,
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B01111110
},
// P
{
B11111110,
B10000001,
B10000001,
B11111110,
B10000000,
B10000000,
B10000000,
B10000000
},
// Q
{
B01111110,
B10000001,
B10000001,
B10000001,
B10001001,
B10000101,
B10000011,
B01111111
},
// R
{
B11111110,
B10000001,
B10000001,
B11111110,
B10000100,
B10000010,
B10000001,
B10000000
},
// S
{
B01111110,
B10000000,
B10000000,
B01111110,
B00000001,
B00000001,
B10000001,
B01111110
},
// T
{
B11111111,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000
},
// U
{
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B01111110
},
// V
{
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B10000001,
B01000010,
B00111100
},
// W
{
B10000001,
B10000001,
B10000001,
B10011001,
B10100101,
B11000011,
B10000001,
B10000001
},
// X
{
B10000001,
B10000001,
B01000010,
B00111100,
B00111100,
B01000010,
B10000001,
B10000001
},
// Y
{
B10000001,
B10000001,
B01000010,
B00111100,
B00011000,
B00011000,
B00011000,
B00011000
},
// Z
{
B11111111,
B00000001,
B00000010,
B00011100,
B00110000,
B01000000,
B10000000,
B11111111
}
};
void setup() {
// Initialize the MAX7219
lc.shutdown(0, false);
lc.setIntensity(0, 8);
lc.clearDisplay(0);
}
void shiftAlphabetRight(int delayTime) {
int numLetters = 26; // Number of letters from A to Z
for (int i = 0; i < numLetters * 8; i++) {
int letterIndex = i % numLetters;
int col = i / numLetters;
for (int row = 0; row < 8; row++) {
byte currentLetter = alphabetPatterns[letterIndex][row] >> col;
byte nextLetter = alphabetPatterns[(letterIndex + 1) % numLetters][row] << (8 - col);
byte interpolatedValue = currentLetter | nextLetter;
lc.setRow(0, row, interpolatedValue);
}
delay(delayTime);
}
}
void loop() {
shiftAlphabetRight(500);
}