int mypins[] = {2,3,4,5,6,8,7};
int counterdata[10][7] = {{HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,LOW},
{LOW,HIGH,HIGH,LOW,LOW,LOW,LOW},
{HIGH,HIGH,LOW,HIGH,HIGH,LOW,HIGH},
{HIGH,HIGH,HIGH,HIGH,LOW,LOW,HIGH},
{LOW,HIGH,HIGH,LOW,LOW,HIGH,HIGH},
{HIGH,LOW,HIGH,HIGH,LOW,HIGH,HIGH},
{HIGH,LOW,HIGH,HIGH,HIGH,HIGH,HIGH},
{HIGH,HIGH,HIGH,LOW,LOW,LOW,LOW},
{HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH},
{HIGH,HIGH,HIGH,HIGH,LOW,HIGH,HIGH,}
};
int showdigits(int segments[]){
for(int i = 0; i<7 ; i++){
Serial.print(mypins[i]);
Serial.println(segments[i]^1);
digitalWrite(mypins[i], segments[i]^1);
}
}
void setup() {
Serial.begin(115200);
for(int i = 0; i<=7; i++){
pinMode(mypins[i], OUTPUT);
}
pinMode(12, INPUT_PULLUP);
}
void loop() {
for(int i = 0; i<=9 ; i++){
showdigits(counterdata[i]);
while(digitalRead(12) == HIGH);{
delay(10);
}
while(digitalRead(12) == LOW);{
delay(10);
}
}
}