// This Arduino NANO code is developed by MARVIN QUIZZAGAN, DEC.30.2024. TESTED 100% WORKING
// THIS IS A SKETCH FOR MODULE_H nano_B FOR LED MATRIX MODULE
// USING TWO DIFFERENT LED MATRIX WITH INDEPENDENT PATTERNS
// THE FUNCTIONS WILL BE BASE ON INPUT SIGNALS D2 (to the left), D3 (to the right),
// A2 (option1), A3(option2), A4(option3), D4 (enable/disable man/auto), D13 (high = normal operations, low = reset, disregard the codes, clear display)
#include <LedControl.h>
// Pin configuration for the first MAX7219
int DIN1 = 7; // Data in pin for the first module
int CS1 = 6; // Chip select pin for the first module
int CLK1 = 5; // Clock pin for the first module
// Pin configuration for the second MAX7219
int DIN2 = 12; // Data in pin for the second module
int CS2 = 11; // Chip select pin for the second module
int CLK2 = 10; // Clock pin for the second module
// Input pins
int inputPinA0 = 2; // Interrupt-capable pin for A0
int inputPinA1 = 3; // Interrupt-capable pin for A1
int inputPinA2 = A2; // Non-interrupt pins
int inputPinA3 = A3;
int inputPinA4 = A4;
int inputPinD4 = 4; // D4 for auto mode priority
// Pin configuration for D13
int inputPinD13 = 13; // D13 to monitor system status (with pull-down resistor)
// Create LedControl objects for each MAX7219
LedControl lc1 = LedControl(DIN1, CLK1, CS1, 1);
LedControl lc2 = LedControl(DIN2, CLK2, CS2, 1);
// Flags for interrupt handling
volatile bool a0Triggered = false;
volatile bool a1Triggered = false;
// Eye patterns for different animations
byte eyeOpen[8] = {
B00111100,
B01111110,
B11111111,
B11100111,
B11100111,
B11111111,
B01111110,
B00111100
};
byte eyeWink[8] = {
B00000000,
B01111110,
B11111111,
B11100111,
B11100111,
B11111111,
B01111110,
B00000000
};
byte eyeClosed[8] = {
B00000000,
B00000000,
B00000000,
B11111111,
B11111111,
B00000000,
B00000000,
B00000000
};
byte eyeClosedTotal[8] = {
B00000000,
B00000000,
B00000000,
B00000000,
B11111111,
B00000000,
B00000000,
B00000000
};
byte eyeRight1[8] = {
B00111100,
B01111110,
B11111111,
B11001111,
B11001111,
B11111111,
B01111110,
B00111100
};
byte eyeRight2[8] = {
B00111100,
B01111110,
B11111111,
B10011111,
B10011111,
B11111111,
B01111110,
B00111100
};
byte eyeRight3[8] = {
B00111100,
B01111110,
B11111111,
B00111111,
B00111111,
B11111111,
B01111110,
B00111100
};
byte eyeLeft1[8] = {
B00111100,
B01111110,
B11111111,
B11110011,
B11110011,
B11111111,
B01111110,
B00111100
};
byte eyeLeft2[8] = {
B00111100,
B01111110,
B11111111,
B11111001,
B11111001,
B11111111,
B01111110,
B00111100
};
byte eyeLeft3[8] = {
B00111100,
B01111110,
B11111111,
B11111100,
B11111100,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft1[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111100,
B11111100,
B01111110,
B00111100
};
byte eyeRollLeft2[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111111,
B11111001,
B01111000,
B00111100
};
byte eyeRollLeft3[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111111,
B11111111,
B01110010,
B00110000
};
byte eyeRollLeft4[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111111,
B11111111,
B01100110,
B00100100
};
byte eyeRollLeft5[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111111,
B11111111,
B01001110,
B00001100
};
byte eyeRollLeft6[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B11111111,
B10011111,
B00011110,
B00111100
};
byte eyeRollLeft7[8] = {
B00111100,
B01111110,
B11111111,
B11111111,
B00111111,
B00111111,
B01111110,
B00111100
};
byte eyeRollLeft8[8] = {
B00111100,
B01111110,
B11111111,
B00111111,
B00111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft9[8] = {
B00111100,
B01111110,
B00111111,
B00111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft10[8] = {
B00111100,
B00011110,
B10011111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft11[8] = {
B00001100,
B01001110,
B11111111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft12[8] = {
B00100100,
B01100110,
B11111111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft13[8] = {
B00110000,
B01110010,
B11111111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft14[8] = {
B00111100,
B01111000,
B11111001,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollLeft15[8] = {
B00111100,
B01111110,
B11111100,
B11111100,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollUp1[8] = {
B00111100,
B01111110,
B11100111,
B11100111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeRollUp2[8] = {
B00111100,
B01100110,
B11100111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100
};
byte eyeHeart1[8] = {
B01100110,
B11111111,
B11111111,
B11111111,
B11111111,
B01111110,
B00111100,
B00011000
};
byte eyeHeart2[8] = {
B00000000,
B00100100,
B01111110,
B01111110,
B01111110,
B00111100,
B00011000,
B00000000
};
byte eyeHeart3[8] = {
B00000000,
B00000000,
B00100100,
B00111100,
B00111100,
B00011000,
B00000000,
B00000000
};
byte eyeSmall1[8] = {
B01111110,
B00000000,
B00111100,
B01111110,
B01100110,
B01100110,
B01111110,
B00111100
};
byte eyeSmall2[8] = {
B01111110,
B00000000,
B00000000,
B01111110,
B01100110,
B01100110,
B01111110,
B00111100
};
byte eyeSmall3[8] = {
B01111110,
B00000000,
B00000000,
B00000000,
B01100110,
B01100110,
B01111110,
B00111100
};
byte eyeSmall4[8] = {
B01111110,
B00000000,
B00000000,
B00000000,
B00000000,
B01100110,
B01111110,
B00111100
};
byte eyeSmall5[8] = {
B01111110,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B01111110,
B00111100
};
byte eyeSmall6[8] = {
B01111110,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00111100
};
byte eyeM[8] = {
B10000001,
B11000011,
B11100111,
B11111111,
B11111111,
B11011011,
B11000011,
B11000011
};
byte eyeA[8] = {
B00111100,
B01111110,
B11000011,
B11000011,
B11111111,
B11111111,
B11000011,
B11000011
};
byte eyeR[8] = {
B11111100,
B11111110,
B11000011,
B11000011,
B11111110,
B11111100,
B11001110,
B11000111
};
byte eyeV[8] = {
B11000011,
B11000011,
B11000011,
B11000011,
B11100111,
B01111110,
B00111100,
B00011000
};
byte eyeI[8] = {
B01111110,
B01111110,
B00011000,
B00011000,
B00011000,
B00011000,
B01111110,
B01111110
};
byte eyeN[8] = {
B11000011,
B11000011,
B11100011,
B11110011,
B11011011,
B11001111,
B11000111,
B11000011
};
byte eyeD[8] = {
B11111100,
B11111110,
B11000111,
B11000011,
B11000011,
B11000111,
B11111110,
B11111100
};
byte eyeE[8] = {
B11111111,
B11111111,
B11000000,
B11111100,
B11000000,
B11000000,
B11111111,
B11111111
};
byte eyeS[8] = {
B01111110,
B11111111,
B11000001,
B01111100,
B00111111,
B10000011,
B11111111,
B01111110
};
byte eyeG[8] = {
B01111110,
B11111111,
B11000000,
B11001111,
B11001111,
B11000011,
B11111111,
B01111110
};
byte eyeBlank[8] = {
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000
};
byte eyeSurprised[8] = {
B00111100,
B01111110,
B11100111,
B11000011,
B11000011,
B11100111,
B01111110,
B00111100
};
byte eyeSquint[8] = {
B00000000,
B00111100,
B01111110,
B11111111,
B11111111,
B01111110,
B00111100,
B00000000
};
byte eyeHeartBeat[8] = {
B00011000,
B00111100,
B01111110,
B11111111,
B11111111,
B01111110,
B00111100,
B00011000
};
// Interrupt service routines
void handleA0Interrupt() { a0Triggered = true; }
void handleA1Interrupt() { a1Triggered = true; }
// Function to display a specific eye pattern on both MAX7219 modules
void displayEye(byte pattern[]) {
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, pattern[row]);
lc2.setRow(0, row, pattern[row]);
}
}
// Function to reset and stop all operations
void resetSystem() {
// Clear both displays
lc1.clearDisplay(0);
lc2.clearDisplay(0);
// Detach interrupts
detachInterrupt(digitalPinToInterrupt(inputPinA0));
detachInterrupt(digitalPinToInterrupt(inputPinA1));
// Halt the system
while (true) {
// Optionally blink the built-in LED to indicate reset mode
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
}
// Setup function
void setup() {
// Configure input pins
pinMode(inputPinD4, INPUT_PULLUP); // D4 as input with pull-up
pinMode(inputPinA0, INPUT_PULLUP);
pinMode(inputPinA1, INPUT_PULLUP);
pinMode(inputPinA2, INPUT_PULLUP);
pinMode(inputPinA3, INPUT_PULLUP);
pinMode(inputPinA4, INPUT_PULLUP);
pinMode(inputPinD13, INPUT); // D13 as input (pull-down resistor is external)
// Initialize both MAX7219 modules
lc1.shutdown(0, false); // Wake up first display
lc1.setIntensity(0, 8); // Set brightness for the first display
lc1.clearDisplay(0); // Clear the first display
lc2.shutdown(0, false); // Wake up second display
lc2.setIntensity(0, 8); // Set brightness for the second display
lc2.clearDisplay(0); // Clear the second display
// Attach interrupts
attachInterrupt(digitalPinToInterrupt(inputPinA0), handleA0Interrupt, FALLING);
attachInterrupt(digitalPinToInterrupt(inputPinA1), handleA1Interrupt, FALLING);
}
// Main loop
void loop() {
// Continuously check D13 state
checkD13();
// Normal operations
if (digitalRead(inputPinD4) == HIGH) {
autoMode(); // Enter auto mode when D4 is HIGH
return; // Exit the loop to prioritize auto mode
}
// If D4 is LOW, process other inputs
if (a0Triggered) {
a0Triggered = false;
displaySequenceA0(); // Execute A0 sequence
} else if (a1Triggered) {
a1Triggered = false;
displaySequenceA1(); // Execute A1 sequence
} else if (digitalRead(inputPinA2) == LOW) {
displaySequenceA2(); // Execute A2 sequence
} else if (digitalRead(inputPinA3) == LOW) {
displaySequenceA3(); // Execute A3 sequence
} else if (digitalRead(inputPinA4) == LOW) {
displaySequenceA4(); // Execute A4 sequence
} else if (digitalRead(inputPinA0) == LOW) {
displaySequenceA0(); // Execute A0 if A0 input is LOW
} else if (digitalRead(inputPinA1) == LOW) {
displaySequenceA1(); // Execute A1 if A1 input is LOW
} else {
displayDefaultAnimation(); // Run default animation if no inputs are active
}
}
// Function to reset and disable the system
void systemResetAndDisable() {
// Clear all displays
lc1.clearDisplay(0);
lc2.clearDisplay(0);
// Detach all interrupts
detachInterrupt(digitalPinToInterrupt(inputPinA0));
detachInterrupt(digitalPinToInterrupt(inputPinA1));
// Reset the system by reinitializing hardware
setup();
// Enter a halt state (do nothing)
while (digitalRead(inputPinD13) == LOW) {
// Keep the system in halt state until D13 is HIGH again
}
}
// Function to continuously check D13 state
void checkD13() {
if (digitalRead(inputPinD13) == LOW) {
systemResetAndDisable();
}
}
// Auto mode function (D4 HIGH)
void autoMode() {
detachInterrupt(digitalPinToInterrupt(inputPinA0));
detachInterrupt(digitalPinToInterrupt(inputPinA1));
while (digitalRead(inputPinD4) == HIGH) { // Stay in auto mode while D4 is HIGH
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight3[row]);
lc2.setRow(0, row, eyeRight3[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight2[row]);
lc2.setRow(0, row, eyeRight2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight1[row]);
lc2.setRow(0, row, eyeRight1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]);
lc2.setRow(0, row, eyeOpen[row]);
}
delay(150);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft1[row]);
lc2.setRow(0, row, eyeLeft1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft2[row]);
lc2.setRow(0, row, eyeLeft2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft3[row]);
lc2.setRow(0, row, eyeLeft3[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft2[row]);
lc2.setRow(0, row, eyeLeft2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft1[row]);
lc2.setRow(0, row, eyeLeft1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]);
lc2.setRow(0, row, eyeOpen[row]);
}
delay(150);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight1[row]);
lc2.setRow(0, row, eyeRight1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight2[row]);
lc2.setRow(0, row, eyeRight2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight3[row]);
lc2.setRow(0, row, eyeRight3[row]); //
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]);
lc2.setRow(0, row, eyeWink[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]);
lc2.setRow(0, row, eyeClosed[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosedTotal[row]);
lc2.setRow(0, row, eyeClosedTotal[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]);
lc2.setRow(0, row, eyeClosed[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]);
lc2.setRow(0, row, eyeWink[row]);
}
delay(100);
checkD13(); // Check D13 state
}
attachInterrupt(digitalPinToInterrupt(inputPinA0), handleA0Interrupt, FALLING);
attachInterrupt(digitalPinToInterrupt(inputPinA1), handleA1Interrupt, FALLING);
}
// Placeholder functions for sequences
// Example sequence functions
void displaySequenceA0() {
while (digitalRead(2) == LOW) { // Loop while D2 is LOW
if (digitalRead(4) == HIGH) {
autoMode(); // Enter Auto Mode if D4 is HIGH
return; // Exit the current sequence immediately
}
checkD13(); // Check D13 state
// Execute the animation sequence for A0
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]);
lc2.setRow(0, row, eyeOpen[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight1[row]);
lc2.setRow(0, row, eyeRight1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight2[row]);
lc2.setRow(0, row, eyeRight2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight3[row]);
lc2.setRow(0, row, eyeRight3[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight2[row]);
lc2.setRow(0, row, eyeRight2[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeRight1[row]);
lc2.setRow(0, row, eyeRight1[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]);
lc2.setRow(0, row, eyeOpen[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]);
lc2.setRow(0, row, eyeWink[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]);
lc2.setRow(0, row, eyeClosed[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosedTotal[row]);
lc2.setRow(0, row, eyeClosedTotal[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]);
lc2.setRow(0, row, eyeClosed[row]);
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]);
lc2.setRow(0, row, eyeWink[row]);
}
delay(100);
checkD13(); // Check D13 state
// Check if D2 has become HIGH to exit the loop
if (digitalRead(2) == HIGH) {
displayDefaultAnimation(); // Call the default animation
return; // Exit the function
}
checkD13(); // Check D13 state
}
}
void displaySequenceA1() {
while (digitalRead(3) == LOW) { // Loop while D3 is LOW
if (digitalRead(4) == HIGH) {
autoMode(); // Enter Auto Mode if D4 is HIGH
return; // Exit the current sequence immediately
}
checkD13(); // Check D13 state
// Execute the animation sequence for A1
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeOpen[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft1[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeLeft1[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft2[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeLeft2[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft3[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeLeft3[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft2[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeLeft2[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeLeft1[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeLeft1[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeOpen[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeWink[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosed[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosedTotal[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosedTotal[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosed[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeWink[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
// Check if D3 has become HIGH to exit the loop
if (digitalRead(3) == HIGH) {
displayDefaultAnimation(); // Call the default animation
return; // Exit the function
}
checkD13(); // Check D13 state
}
}
void displaySequenceA2() {
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeBlank[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeHeart1[row]); // Pattern for the second MAX7219
}
delay(250);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeHeart3[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeHeart2[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeHeart2[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeHeart3[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeHeart1[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeBlank[row]); // Pattern for the second MAX7219
}
delay(250);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeHeart2[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeHeart3[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeHeart3[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeHeart2[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
}
void displaySequenceA3() {
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall1[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall1[row]); // Pattern for the second MAX7219
}
delay(2000);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall2[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall2[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall3[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall3[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall4[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall4[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall5[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall5[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeSmall6[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeSmall6[row]); // Pattern for the second MAX7219
}
delay(100);
checkD13(); // Check D13 state
}
void displaySequenceA4() {
for (int row = 0; row < 8; row++) { // set 1
lc2.setRow(0, row, eyeM[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeA[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 2
lc2.setRow(0, row, eyeA[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeR[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 3
lc2.setRow(0, row, eyeR[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeV[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 4
lc2.setRow(0, row, eyeV[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeI[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 5
lc2.setRow(0, row, eyeI[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeN[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 6
lc2.setRow(0, row, eyeN[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeBlank[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 7
lc2.setRow(0, row, eyeBlank[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeBlank[row]); // Pattern for the second MAX7219
}
delay(500);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) { // set 8
lc2.setRow(0, row, eyeBlank[row]); // Pattern for the first MAX7219
lc1.setRow(0, row, eyeM[row]); // Pattern for the second MAX7219
}
delay(300);
checkD13(); // Check D13 state
}
// Default animation when no inputs are active
void displayDefaultAnimation() {
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeOpen[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeOpen[row]); // Pattern for the second MAX7219
}
delay(2000);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeWink[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosed[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosedTotal[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosedTotal[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeClosed[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeClosed[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
for (int row = 0; row < 8; row++) {
lc1.setRow(0, row, eyeWink[row]); // Pattern for the first MAX7219
lc2.setRow(0, row, eyeWink[row]); // Pattern for the second MAX7219
}
delay(20);
checkD13(); // Check D13 state
}