/*
Arduino | general -help
Jordan Belfort — 6/14/24 at 3:18 PM
I'm trying to use a MAX7219 led driver to control a 8x8 matrix,
no matter what I do, all the leds are always ON
I was trying to turn ON only one column every one second,
but the only thing that happened was one column getting dimmed
every second while the rest was ON
*/
#include <LedControl.h>
#include <MD_MAX72xx.h>
// Pin de datos (DIN), reloj (CLK) y chip select (CS)
const int DATA_IN = 2;
const int CLK = 4;
const int CS = 3;
// Crear un objeto LedControl para el MAX7219
LedControl lc = LedControl(DATA_IN, CLK, CS, 1);
void setup() {
// Inicializar la comunicación con el MAX7219
lc.shutdown(0, false);
lc.setIntensity(0, 8);
lc.clearDisplay(0);
}
void loop() {
for (int col = 0; col < 8; col++) {
// Apagar todos los LEDs de la matriz
for (int c = 0; c < 8; c++) {
for (int row = 0; row < 8; row++) {
lc.setLed(0, row, c, false);
}
}
// Encender todos los LEDs en la columna actual
for (int row = 0; row < 8; row++) {
lc.setLed(0, row, col, true);
}
// Esperar 1 segundo
delay(1000);
}
}