#include <LedControl.h>
// Configurazione dei pin: DIN, CLK, CS
LedControl lc = LedControl(8, 10, 9, 1); // (DIN=8, CLK=10, CS=9)
// Array
const uint8_t IMAGES[][8] = {
{
0b00011000,
0b00111100,
0b01111110,
0b11111111,
0b00011000,
0b00011000,
0b00011000,
0b00011000
},
{
0b00011111,
0b00001111,
0b00011111,
0b00111111,
0b01111001,
0b11110000,
0b11100000,
0b11000000
},
{
0b00001000,
0b00001100,
0b00001110,
0b11111111,
0b11111111,
0b00001110,
0b00001100,
0b00001000
},
{
0b11100000,
0b11110000,
0b01111000,
0b00111101,
0b00011111,
0b00001111,
0b00001111,
0b00011111
},
{
0b00011000,
0b00011000,
0b00011000,
0b00011000,
0b11111111,
0b01111110,
0b00111100,
0b00011000
},
{
0b00000011,
0b00000111,
0b00001111,
0b10011110,
0b11111100,
0b11111000,
0b11110000,
0b11111000
},
{
0b00010000,
0b00110000,
0b01110000,
0b11111111,
0b11111111,
0b01110000,
0b00110000,
0b00010000
},
{
0b11111000,
0b11110000,
0b11110000,
0b11111000,
0b10111100,
0b00011110,
0b00001111,
0b00000111
}
};
// Calcola il numero di immagini
const int IMAGES_LEN = sizeof(IMAGES) / sizeof(IMAGES[0]);
void setup() {
lc.shutdown(0, false); // Attiva il display
lc.setIntensity(0, 8); // Imposta la luminosità
lc.clearDisplay(0); // Pulisce il display
}
void loop() {
for (int i = 0; i < IMAGES_LEN; i++) {//ciclo for
displayImage(IMAGES[i]); // Mostra l'immagine
delay(300); // Ritardo
}
}
// Funzione per stampare la freccia
void displayImage(const uint8_t image[8]) {
for (int row = 0; row < 8; row++) {
lc.setRow(0, row, image[row]);
}
}