int pins[] = {2, 3, 4, 5, 6, 7, 8, 9};
int pr_values[][8] = {
  {0, 0, 0, 0, 0, 0, 1, 0},
  {1, 0, 0, 1, 1, 1, 1, 1}, 
  {0, 0, 1, 0, 0, 1, 0, 0}, 
  {0, 0, 0, 0, 1, 1, 0, 0}, 
  {1, 0, 0, 1, 1, 0, 0, 0}, 
  {0, 1, 0, 0, 1, 0, 0, 0}, 
  {0, 1, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 1, 1, 1, 1, 0},
  {0, 0, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 0, 1, 0, 0, 0}
};

int buttonPin = 10;
int buttonState = 0;
int lastButtonState = 0;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
int currentNumber = 0;
int count = 0;

void displayNumber(int number) {
  for (int i = 0; i < 8; i++)
    digitalWrite(pins[i], pr_values[number][i]);
}

void setup() {
  for (int i = 0; i < 8; i++)
    pinMode(pins[i], OUTPUT);

  pinMode(buttonPin, INPUT);
  
  displayNumber(count);
}



void loop() {
  int reading = digitalRead(buttonPin);

  if (reading != lastButtonState) {
    lastDebounceTime = millis();
  }

  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (reading != buttonState) {
      buttonState = reading; 

      if (buttonState == HIGH) {
        // currentNumber = (currentNumber + 1) % 10;
        if (count > 9) {
          count = 0;
        }
        
        count += 1;
        displayNumber(count);
      }
    }
  }

  lastButtonState = reading;
}