#include "Max72xxPanel.h" // Bibliothek für MAX7219 ansteuerung
#include <Adafruit_GFX.h>
#define DIN 12 // Data-In Pin des MAX7219 an Arduino Pin 51
#define CS 11 // Chip-Select Pin des MAX7219 an Arduino Pin 53
#define CLK 10 // Clock Pin des MAX7219 an Arduino Pin 52
#define POT A0 // Pin des Potentiometers an Analog-Pin 0
Max72xxPanel lc = Max72xxPanel (DIN, CLK, CS, 1); // LED Matrix initialisieren
void setup() {
lc.shutdown(0, false); // MAX7219 aktivieren
lc.setIntensity(0, 8); // Helligkeit auf mittlere Stufe setzen
lc.clearDisplay(0); // Matrix leeren
}
void loop() {
int potVal = analogRead(A0); // Potentiometerwert lesen
int intensityVal = map(potVal, 0, 1023, 0, 15); // Potentiometerwert auf Helligkeitsbereich mappen
lc.setIntensity(0, intensityVal); // Helligkeit setzen
// LED Matrix komplett zum Leuchten bringen
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 8; col++) {
lc.setLed(0, row, col, true);
delay(50); // kleine Pause zwischen jedem Pixel
}
}
}