int DisplayPins[] = {15,2,0,4,16,17,5};
int ButtonPin = 18;
int cnt = 0;
int _7SegmentSetup[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}
};
void setup()
{
for(int i = 0; i < 7; i++)
{
pinMode(DisplayPins[i], OUTPUT);
}
pinMode(ButtonPin, INPUT_PULLUP);
}
void loop()
{
if(digitalRead(ButtonPin) == LOW)
{
if(cnt > 8)
{
cnt = 0;
}
else
{
cnt++;
}
for(int i = 0; i < 7; i++)
{
digitalWrite(DisplayPins[i], _7SegmentSetup[cnt][i]);
}
delay(250);
}
delay(50);
}