#include <LedControl.h>
// Define the pins for the LED matrix
const int DIN_PIN = 11; // Connect to DIN
const int CLK_PIN = 13; // Connect to CLK
const int CS_PIN = 10; // Connect to CS
// Define the button pins
const int prevButtonPin = 2; // Previous Character button
const int nextButtonPin = 3; // Next Character button
const uint64_t IMAGES[] PROGMEM = {
0x0033333f33331e0c,
0x003f66663e66663f,
0x003c66030303663c,
0x001f36666666361f,
0x007f46161e16467f,
0x000f06161e16467f,
0x007c66730303663c,
0x003333333f333333,
0x001e0c0c0c0c0c1e,
0x001e333330303078,
0x006766361e366667,
0x007f66460606060f,
0x0063636b7f7f7763,
0x006363737b6f6763,
0x001c36636363361c,
0x000f06063e66663f,
0x00381e3b3333331e,
0x006766363e66663f,
0x001e33380e07331e,
0x001e0c0c0c0c2d3f,
0x003f333333333333,
0x000c1e3333333333,
0x0063777f6b636363,
0x0063361c1c366363,
0x001e0c0c1e333333,
0x007f664c1831637f,
0x0000000000000000,
0x006e333e301e0000,
0x003b66663e060607,
0x001e3303331e0000,
0x006e33333e303038,
0x001e033f331e0000,
0x000f06060f06361c,
0x1f303e33336e0000,
0x006766666e360607,
0x001e0c0c0c0e000c,
0x1e33333030300030,
0x0067361e36660607,
0x001e0c0c0c0c0c0e,
0x00636b7f7f330000,
0x00333333331f0000,
0x001e3333331e0000,
0x0f063e66663b0000,
0x78303e33336e0000,
0x000f06666e3b0000,
0x001f301e033e0000,
0x00182c0c0c3e0c08,
0x006e333333330000,
0x000c1e3333330000,
0x00367f7f6b630000,
0x0063361c36630000,
0x1f303e3333330000,
0x003f260c193f0000
};
const int IMAGES_LEN = sizeof(IMAGES)/8;
LedControl display = LedControl(DIN_PIN, CLK_PIN, CS_PIN, 1);
void setup() {
display.clearDisplay(0);
display.shutdown(0, false);
display.setIntensity(0, 10);
}
void displayImage(uint64_t image) {
for (int i = 0; i < 8; i++) {
byte row = (image >> (7 - i) * 8) & 0xFF; // Reverse the bit order
for (int j = 0; j < 8; j++) {
display.setLed(0, i, j, bitRead(row, j));
}
}
}
int i = 0;
void loop() {
uint64_t image;
memcpy_P(&image, &IMAGES[i], 8);
displayImage(image);
if (++i >= IMAGES_LEN ) {
i = 0;
}
delay(1000);
}