// #include <Arduino.h>
const int SEGMENT0_PINS[] = {23, 22, 16, 5, 18, 21, 2};
const int SEGMENT1_PINS[] = {32, 33, 13, 12, 27, 25, 26};
int digit[10][7] = {
{0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 1, 1, 1, 1},
{0, 0, 1, 0, 0, 1, 0},
{0, 0, 0, 0, 1, 1, 0},
{1, 0, 0, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0},
{0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0}
};
void setup() {
for (int i = 0; i < 7; i++) {
pinMode(SEGMENT0_PINS[i], OUTPUT);
pinMode(SEGMENT1_PINS[i], OUTPUT);
}
}
void displayNumber(int num) {
int hd = num / 10;
int ld = num % 10;
for (int j = 0; j < 7; j++) {
digitalWrite(SEGMENT1_PINS[j], digit[hd][j]);
}
for (int k = 0; k < 7; k++) {
digitalWrite(SEGMENT0_PINS[k], digit[ld][k]);
}
delay(1000);
}
void loop() {
for (int i = 0; i < 100; i++) {
displayNumber(i);
}
}