int stav;


void setup() 
{
  DDRD &= ~(1<<5);
  PORTD |= 1<<5; 

  DDRD &= ~(1<<4);
  PORTD |= 1<<4; 

  DDRD &= ~(1<<7);
  PORTD |= 1<<7; 

  DDRB |= 1<<0;

  SREG |= 1<<7;

  PCICR |= 1<<PCIE2;

  PCMSK2 |= 1<<PCINT20;
  PCMSK2 |= 1<<PCINT21;
  PCMSK2 |= 1<<PCINT23;
}

void loop()
{
  
  if(stav == 2)
  {
    PORTB |= 1<<0;
    delay(500);
    PORTB &= ~(1<<0);
    delay(500);
  }
   if(stav == 1)
  {
    PORTB |= 1<<0;
  }
   if(stav == 0)
  {
    PORTB &= ~(1<<0);
  }

}

ISR(PCINT2_vect)
{
  if((PIND & (1<<5)) == 0)
  stav = 0;
  else if ((PIND & (1<<4)) == 0)
  stav = 2;
  else if ((PIND & (1<<7)) == 0)
  stav = 1;
}