// Define pins for each segment of two 7-segment displays int a = 2; int b = 3; int c = 4; int d = 5; int e = 6; int f = 7; int g = 8; int a1 = 9; int b1 = 10; int c1 = 11; int d1 = 12; int e1 = 13; int f1 = A0; int g1 = A1; void setup() { // Set all segment pins as output pinMode(a, OUTPUT); pinMode(b, OUTPUT); pinMode(c, OUTPUT); pinMode(d, OUTPUT); pinMode(e, OUTPUT); pinMode(f, OUTPUT); pinMode(g, OUTPUT); pinMode(a1, OUTPUT); pinMode(b1, OUTPUT); pinMode(c1, OUTPUT); pinMode(d1, OUTPUT); pinMode(e1, OUTPUT); pinMode(f1, OUTPUT); pinMode(g1, OUTPUT); } // Function to display a single digit on the left (tens place) 7-segment display void displayDigit(int digit) { // Turn off all segments initially digitalWrite(a, LOW); digitalWrite(b, LOW); digitalWrite(c, LOW); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); // Turn on specific segments for the digit switch (digit) { case 0: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); break; case 1: digitalWrite(b, HIGH); digitalWrite(c, HIGH); break; case 2: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(g, HIGH); break; case 3: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(g, HIGH); break; case 4: digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); break; case 5: digitalWrite(a, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); break; case 6: digitalWrite(a, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); break; case 7: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); break; case 8: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); break; case 9: digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); break; } } // Function to display a single digit on the right (units place) 7-segment display void displayDigit1(int digit) { // Turn off all segments initially digitalWrite(a1, LOW); digitalWrite(b1, LOW); digitalWrite(c1, LOW); digitalWrite(d1, LOW); digitalWrite(e1, LOW); digitalWrite(f1, LOW); digitalWrite(g1, LOW); // Turn on specific segments for the digit switch (digit) { case 0: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(e1, HIGH); digitalWrite(f1, HIGH); break; case 1: digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); break; case 2: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(d1, HIGH); digitalWrite(e1, HIGH); digitalWrite(g1, HIGH); break; case 3: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(g1, HIGH); break; case 4: digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); digitalWrite(f1, HIGH); digitalWrite(g1, HIGH); break; case 5: digitalWrite(a1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(f1, HIGH); digitalWrite(g1, HIGH); break; case 6: digitalWrite(a1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(e1, HIGH); digitalWrite(f1, HIGH); digitalWrite(g1, HIGH); break; case 7: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); break; case 8: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(e1, HIGH); digitalWrite(f1, HIGH); digitalWrite(g1, HIGH); break; case 9: digitalWrite(a1, HIGH); digitalWrite(b1, HIGH); digitalWrite(c1, HIGH); digitalWrite(d1, HIGH); digitalWrite(f1, HIGH); digitalWrite(g1, HIGH); break; } } void loop() { for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { displayDigit(i); // Display tens place displayDigit1(j); // Display units place delay(1000); // Wait for 1 second } } }