int stav;


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

  DDRB &= ~(1<<2);
  PORTB |= 1<<2; 

  DDRC &= ~(1<<0);
  PORTC |= 1<<0; 

  DDRB |= 1<<0;

  SREG |= 1<<7;

  PCICR |= 1<<PCIE0;
  PCICR |= 1<<PCIE1;
  PCICR |= 1<<PCIE2;

  PCMSK0 |= 1<<PCINT2;
  PCMSK1 |= 1<<PCINT8;
  PCMSK2 |= 1<<PCINT21;
}

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(PCINT0_vect)
{
  stav = 1;
}
ISR(PCINT1_vect)
{
  stav = 2;
}
ISR(PCINT2_vect)
{
  stav = 0;
}