#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27,20,4);
byte zmena = false;
bool torpeda[4];

void setup() 
{
  lcd.init();
  lcd.backlight();
  SREG |= 1<<7;

  PCICR |= 1<<PCIE2;

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

  DDRD |= 0b00000000;
  PORTD |= 0b11111111;

  lcd.setCursor (0,0);
  lcd.print ("Komora 1:");   
  lcd.setCursor (0,1);
  lcd.print ("Komora 2:"); 
  lcd.setCursor (0,2);
  lcd.print ("Komora 3:"); 
  lcd.setCursor (0,3);
  lcd.print ("Komora 4:");
}

void loop() 
{
  if(zmena)
  {
    zmena = false;
    for(byte riadok = 0; riadok < 4; riadok++)
    {
      torpeda[riadok] = (PIND & 1<<(7 - riadok));
      lcd.setCursor(10,riadok);
      if(!torpeda[riadok])
        lcd.print("O");
      else
        lcd.print("Z");
    }
  }
}

ISR(PCINT2_vect)
{
  zmena = true;
}