//     x a b c d e f g
// 0 = 0 1 1 1 1 1 1 0 = 0x7E
// 1 = 0 0 1 1 0 0 0 0 = 0x30
// 2 = 0 1 1 0 1 1 0 1 = 0x6D
// 3 = 0 1 1 1 1 0 0 1 = 0x79
// 4 = 0 0 1 1 0 0 1 1 = 0x33
// 5 = 0 1 0 1 1 0 1 1 = 0x5B
// 6 = 0 1 0 1 1 1 1 1 = 0x5F
// 7 = 0 1 1 1 0 0 0 0 = 0x70
// 8 = 0 1 1 1 1 1 1 1 = 0x7F
// 9 = 0 1 1 1 1 0 1 1 = 0x7B

int stRand;
int count;
int digit[] = {0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B};

/*void setup() {
  pinMode(7, INPUT_PULLUP);
  for (int x = 0; x < 7; x++) {
    pinMode (x, OUTPUT);
  }
  randomSeed(analogRead(A0));
  count = random(1, 10);
}

void loop() {
  int k = digit[count];
  if (digitalRead(7) == LOW) {
    count--;
    delay(200);
    if (count <= 0) count = 0;
  }
  for (int x = 0; x < 7; x++) {
    int temp = k & 0x01;
    digitalWrite(x, temp);
    k >>= 1; // k = k >> 1;
  }
}*/



/*void setup() {
  DDRD &= 0x7F;
  PORTD |= 0x80;
  randomSeed(analogRead(A0));
  count = random(1, 10);
}

void loop() {
  bool but = PIND & 0x80; // 0 == False == LOW, 1 == True == HIGH,
  
  if (but == LOW) {
    count--;
    delay(200);
    if (count <= 0) count = 0;
  }
  PORTD = digit[1] | 0x80;
}*/



/*void setup() {
  DDRD=0x7F;
  PORTD|= 0x80;   //PORTD |=0x80;
  randomSeed(analogRead(A0));
  count = random(1,10);
}

void loop() {

  bool vhod = PIND & 0x80;    //0 ali 128
  if(vhod == LOW){
    count--;
    delay(300);
    if (count<=0) count = 0;
  }
  //for(int x = 0; x<10; x++){
    PORTD=digit[count] | 0x80;
}*/