uint8_t segPins[] = {6, 7, 8, 9, 10, 11, 12};
uint8_t moenster[10] = {
  //Bxedcgfba
  B00111111, //0
  B00000110, //1
  B01011011, //2
  B01001111, //3
  B01100110, //4
  B01101101, //5
  B01111101, //6
  B00000111, //7
  B01111111, //8
  B01101111, //9
};

uint8_t taeller = 0;



void setup() {
  Serial.begin(9600);
  pinMode(5, INPUT);
  pinMode(13, OUTPUT);
  // put your setup code here, to run once:
  for (int i = 0; i < sizeof(segPins); i++) {
    pinMode(segPins[i], OUTPUT);

  }
  digitalWrite(13, 1);
}

void loop() {
  // put your main code here, to run repeatedly:
  
    uint8_t x = moenster[taeller];
    for (int i = 0; i < sizeof(moenster); i++) {
      digitalWrite(segPins[i], 1 - bitRead(x, i));
    }
  
  //delay(500);
  if (digitalRead(5) == 1) {
    digitalWrite(13, HIGH);
    taeller++;
    if (taeller > 9) {
      taeller = 0;
    }
    
  }
  while (digitalRead(5) == 1) {
      delay(10);
    }
  Serial.println(taeller);
}