#include <LedControl.h>
// Define the pins for the first matrix
const int DIN = 11;
const int CS = 10;
const int CLK = 13;
// Define the number of matrices in the series
const int NUM_MATRICES = 2;
// Create an instance of the LedControl class
LedControl lc = LedControl(DIN, CLK, CS, NUM_MATRICES);
void setup() {
// Initialize all matrices
for (int i = 0; i < NUM_MATRICES; i++) {
lc.shutdown(i, false);
lc.setIntensity(i, 8);
lc.clearDisplay(i);
}
}
void loop() {
// Display a smiley face on the first matrix
lc.setRow(0, 0, B00000100);
lc.setRow(0, 1, B00001110);
lc.setRow(0, 2, B00000100);
lc.setRow(0, 3, B00000000);
lc.setRow(0, 4, B00001110);
lc.setRow(0, 5, B00001110);
lc.setRow(0, 6, B00001110);
lc.setRow(0, 7, B00000000);
// Display a sad face on the second matrix
lc.setRow(1, 0, B01110000);
lc.setRow(1, 1, B01110000);
lc.setRow(1, 2, B01110000);
lc.setRow(1, 3, B00000000);
lc.setRow(1, 4, B01110000);
lc.setRow(1, 5, B01110000);
lc.setRow(1, 6, B01110000);
lc.setRow(1, 7, B00000000);
// Wait for a second
delay(1000);
}