int CommonAnode[] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90};
int count = 0;
int s = 0;
void setup() {
pinMode(10, INPUT_PULLUP);
DDRD = B11111111;
}
void loop() {
int x = digitalRead(10);
if (x == HIGH && s == 0) {
count++;
if (count > 9) {
count = 0;
}
PORTD = CommonAnode[count];
s = 1;
} else if (x == LOW) {
s = 0;
} else {
PORTD = CommonAnode[count];
count++;
if (count > 9) {
count = 0;
}
delay(800);
}
}