int pins[] = {2, 4, 14, 12, 13, 5, 18}; // Array of pin numbers alphabetical order
// Define the states for each pin in a 2D array
int states[7][10] = {
{0, 1, 0, 0, 1, 0, 0, 0, 0, 0}, // States for pin 'a'
{0, 0, 0, 0, 0, 1, 1, 0, 0, 0}, // States for pin 'b'
{0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, // States for pin 'c'
{0, 1, 0, 0, 1, 0, 0, 1, 0, 0}, // States for pin 'd'
{0, 1, 0, 1, 1, 1, 0, 1, 0, 1}, // States for pin 'e'
{0, 1, 1, 1, 0, 0, 0, 1, 0, 0}, // States for pin 'f'
{1, 1, 0, 0, 0, 0, 0, 1, 0, 0} // States for pin 'g'
};
void setup() {
// Initialize all pins as OUTPUT
for (int i = 0; i < 7; i++) {
pinMode(pins[i], OUTPUT);
}
}
void loop() {
// Loop through each state and write to pins
for (int i = 0; i < 10; i++) { // Loop over time states
for (int j = 0; j < 7; j++) { // Loop over pins
digitalWrite(pins[j], states[j][i] == 1 ? LOW : HIGH);
}
delay(1000); // Wait for 1 second before updating to the next state
}
}