Hi,

The first thing I see is you have mixed inputs and outputs ...

ex; if PIR = 1 then ... etc.etc. ... and PIR is declared as an output ( possible ... but really surprising here !!! )

same for "lights" ...

Begin by checking all your I/0 declares ... ( 0 for OUTPUT and 1 for Input = simple !!! )

Alain