#include <Adafruit_NeoPixel.h>
#define PIN 2
#define NUM_MATRICES 5
#define LEDS_PER_MATRIX 25
#define NUMPIXELS (NUM_MATRICES * LEDS_PER_MATRIX)
#define BRIGHTNESS 1000
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Define the positions of LEDs to form the letters
const int hPattern[] = {0,4,5,9,10,11,12,13,14,15,19,20,24};
const int ePattern[] = {0,1,2,3,4,5,10,11,12,13,14,15,20,21,22,23,24};
const int lPattern[] = {0,5,10,15,20,21,22,23,24};
const int oPattern[] = {0,1,2,3,4,5,9,10,14,15,19,20,21,22,23,24};
void setup() {
pixels.begin();
pixels.setBrightness(BRIGHTNESS);
}
void loop() {
// Display "HELLO" word
displayWord(hPattern, sizeof(hPattern) / sizeof(hPattern[0]), 0);
displayWord(ePattern, sizeof(ePattern) / sizeof(ePattern[0]), 1);
displayWord(lPattern, sizeof(lPattern) / sizeof(lPattern[0]), 2);
displayWord(lPattern, sizeof(lPattern) / sizeof(lPattern[0]), 3);
displayWord(oPattern, sizeof(oPattern) / sizeof(oPattern[0]), 4);
delay(500); // Delay to keep the word on for 1000 milliseconds
pixels.clear(); // Clear all LEDs
// Shift each letter pattern by one whole matrix
for (int matrix = 0; matrix < NUM_MATRICES; matrix++) {
displayWord(hPattern, sizeof(hPattern) / sizeof(hPattern[0]), (matrix + 1) % NUM_MATRICES);
displayWord(ePattern, sizeof(ePattern) / sizeof(ePattern[0]), (matrix + 2) % NUM_MATRICES);
displayWord(lPattern, sizeof(lPattern) / sizeof(lPattern[0]), (matrix + 3) % NUM_MATRICES);
displayWord(lPattern, sizeof(lPattern) / sizeof(lPattern[0]), (matrix + 4) % NUM_MATRICES);
displayWord(oPattern, sizeof(oPattern) / sizeof(oPattern[0]), (matrix + 5) % NUM_MATRICES);
delay(1000); // Delay between shifting each letter by one whole matrix
pixels.clear(); // Clear all LEDs
}
//delay(500); // Delay to keep the LEDs off for 1000 milliseconds
}
// Function to display a letter pattern on the specified matrix
void displayWord(int pattern[], int patternSize, int matrix) {
for (int i = 0; i < patternSize; i++) {
int index = matrix * LEDS_PER_MATRIX + pattern[i];
pixels.setPixelColor(index, pixels.Color(255, 0, 0)); // Red
}
pixels.show(); // Show the updated pixels
}