// 32x8 LED Matrix STOP Sign with Flashing Effect
// Uses 4x 8x8 LED Matrix (MAX7219) modules
#include <LedControl.h>
// Pin connections: DIN=12, CLK=11, CS=10, 4 modules
LedControl lc = LedControl(12, 11, 10, 4);
// Large STOP sign pattern (32x8 - octagon shape)
// Solid filled octagon
byte stopSign[8][4] = {
{B00011111, B11111111, B11111111, B11111000}, // Row 0 - top
{B01111111, B11111111, B11111111, B11111110}, // Row 1
{B11111111, B11111111, B11111111, B11111111}, // Row 2
{B11111111, B11111111, B11111111, B11111111}, // Row 3
{B11111111, B11111111, B11111111, B11111111}, // Row 4
{B11111111, B11111111, B11111111, B11111111}, // Row 5
{B01111111, B11111111, B11111111, B11111110}, // Row 6
{B00011111, B11111111, B11111111, B11111000} // Row 7 - bottom
};
// STOP text pattern - simplified and readable
// Using block letters: S T O P
byte stopText[8][4] = {
{B00011111, B11111111, B11111111, B11111000}, // Row 0
{B01111111, B11111111, B11111111, B11111110}, // Row 1
{B11110111, B01110111, B01110111, B01111111}, // Row 2 - S T O P
{B11110101, B01010101, B01010101, B01111111}, // Row 3 - S T O P
{B11110111, B01010101, B01010111, B01111111}, // Row 4 - S T O P
{B11110001, B01010101, B01010101, B01111111}, // Row 5 - S T O P
{B01111111, B11111111, B11111111, B11111110}, // Row 6
{B00011111, B11111111, B11111111, B11111000} // Row 7
};
// Octagon outline only
byte stopOutline[8][4] = {
{B00011111, B11111111, B11111111, B11111000}, // Row 0
{B01111111, B00000000, B00000000, B11111110}, // Row 1
{B11100000, B00000000, B00000000, B00000111}, // Row 2
{B11000000, B00000000, B00000000, B00000011}, // Row 3
{B11000000, B00000000, B00000000, B00000011}, // Row 4
{B11100000, B00000000, B00000000, B00000111}, // Row 5
{B01111111, B00000000, B00000000, B11111110}, // Row 6
{B00011111, B11111111, B11111111, B11111000} // Row 7
};
void setup() {
// Initialize all 4 matrix modules
for (int i = 0; i < 4; i++) {
lc.shutdown(i, false); // Wake up display
lc.setIntensity(i, 8); // Set brightness (0-15)
lc.clearDisplay(i); // Clear display
}
}
void displayPattern(byte pattern[8][4]) {
// Display pattern across 4 modules (32 columns total)
// Module indexing: 3=leftmost, 2, 1, 0=rightmost (reverse order in chain)
for (int row = 0; row < 8; row++) {
// Module 3 (leftmost) - bits 31-24
lc.setRow(3, row, pattern[row][0]);
// Module 2 - bits 23-16
lc.setRow(2, row, pattern[row][1]);
// Module 1 - bits 15-8
lc.setRow(1, row, pattern[row][2]);
// Module 0 (rightmost) - bits 7-0
lc.setRow(0, row, pattern[row][3]);
}
}
void clearAll() {
for (int i = 0; i < 4; i++) {
lc.clearDisplay(i);
}
}
void loop() {
// Show filled octagon STOP sign
displayPattern(stopSign);
delay(600);
// Show STOP text
displayPattern(stopText);
delay(600);
// Show outline only
displayPattern(stopOutline);
delay(600);
// Flash effect - all off
clearAll();
delay(400);
// Show filled again
displayPattern(stopSign);
delay(600);
// Show text again
displayPattern(stopText);
delay(600);
// All off
clearAll();
delay(400);
}