#define latchPin 13
#define DataPin 11
#define ClockPin 12
#define NUM_SHIFT_REGS 1
const uint8_t numOfRegisterPins = NUM_SHIFT_REGS * 8;
int data[8] = {1, 1, 1, 1, 1, 1, 1, 1};
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(DataPin, OUTPUT);
pinMode(ClockPin, OUTPUT);
digitalWrite(latchPin, LOW);
for (int i = numOfRegisterPins - 1; i >= 0; i--) {
digitalWrite(ClockPin, LOW);
digitalWrite(DataPin, data[i]);
digitalWrite(ClockPin, HIGH);
}
digitalWrite(latchPin, HIGH);
}
void loop() {
}
#include "LedControl.h"
// Pin configuration for the shift register
const int dataPin = 11; // Connect to the DS pin of 74HC595
const int clockPin = 13; // Connect to the SH_CP pin of 74HC595
const int latchPin = 10; // Connect to the ST_CP pin of 74HC595
// Create an instance of the LedControl class
LedControl lc = LedControl(dataPin, clockPin, latchPin, 1);
void setup() {
// Initialize the display
lc.shutdown(0, false); // Enable the display
lc.setIntensity(0, 8); // Set the brightness (0-15)
lc.clearDisplay(0); // Clear the display
}
void loop() {
// Display a pattern
displayPattern();
delay(1000);
}
void displayPattern() {
// Define a custom pattern
byte pattern[8] = {
B00111100,
B01000010,
B10000001,
B10011001,
B10011001,
B10000001,
B01000010,
B00111100
};
// Display the pattern on the LED matrix
for (int row = 0; row < 8; row++) {
lc.setRow(0, row, pattern[row]);
}
}