#include <LedControl.h>
// Pin 12:Data in, Pin 11: Clock, Pin 10: CS(Load)
LedControl display = LedControl(12, 11, 10, 1);
// Up and down arrow bitmap data
const uint64_t UP_DOWN_IMAGES[] = {
/*0x0000000000000000,
0x0000000000000000,
0x000000000000000,
0x0000000000000000,
0x0000000000000000,
0x0000000100000000,
0x0000010301000000,
0x0001030703010000,
0x0103070f07030100,
0x02060f1f0f060200,
0x040c1f3f1f0c0400,
0x08183f7f3f180800,
0x08183f7f3f180800,
0x10307fff7f301000,
0x2060fefefe602000,
0x40c0fcfcfcc04000,
0x8080f8f8f8808000,
0x0000f0f0f0000000,
0x0000e0e0e0000000,
0x0000c0c0c0000000,
0x0000808080000000,
0x0000000000000000,*/
0x0000000000000000,
0x0000000000000000,
0x0000000000000000,
0x0000008000000000,
0x000080c080000000,
0x0080c0e0c0800000,
0x80c0e0f0e0c08000,
0x2030f8fcf8302000,
0x1018fcfefc181000,
0x000000ff00000000,
0x0000008000000000,
};
const int UP_DOWN_IMAGES_LEN = sizeof(UP_DOWN_IMAGES) / sizeof(UP_DOWN_IMAGES[0]);
void setup() {
display.clearDisplay(0); // Clear screen
display.shutdown(0, false); // Turn off power saving mode
display.setIntensity(0, 10); // Set the brightness (between 0 and 15)
}
// Function to display a bitmap image
void displayImage(uint64_t image) {
for (int i = 0; i < 8; i++) {
byte row = (image >> i * 8) & 0xFF;
for (int j = 0; j < 8; j++) {
display.setLed(0, i, j, bitRead(row, j));
}
}
}
void loop() {
// Display arrow moving up
for (int i = 0; i < UP_DOWN_IMAGES_LEN; i++) {
displayImage(UP_DOWN_IMAGES[i]);
delay(400);
}
/*
// Display arrow moving down
for (int i = UP_DOWN_IMAGES_LEN - 2; i > 0; i--) {
displayImage(UP_DOWN_IMAGES[i]);
delay(400);
}*/
displayImage(UP_DOWN_IMAGES[1]);
}