2 room auto lighting with pir's

hi , i have two rooms that im trying to put motion activated light using an 8 relay moduel board
and two "pir" motion sensors.i got the first pir to work,but im struggling to get the second one working.
if i walk into the first room i want the light to come on then turn off after a while,and when im ready to walk into
the other room i want that one to turn on is that possible ? o and here my simple sketch

int room1 = 2;
int room2 = 3;
int motionroom1 = 7;

void setup()
{
pinMode(motionroom1,INPUT);
pinMode(room1,OUTPUT);
pinMode(room2,OUTPUT);
//--------------test--------------------------------//
digitalWrite(room2,HIGH);

digitalWrite(room1,LOW);
delay(500);
digitalWrite(room1,HIGH);
delay(500);
digitalWrite(room2,LOW);
delay(500);
digitalWrite(room2,HIGH);
delay(500);
//-------------------------------------------//
digitalWrite(room1,LOW);
digitalWrite(room2,LOW);
delay(700);
digitalWrite(room1,HIGH);
digitalWrite(room1,HIGH);
delay(800);
}
//-----------------end test--------------------------------//
void loop()
{
if (digitalRead(motionroom1) == HIGH)
{
digitalWrite(room1,LOW);
delay(5000);
digitalWrite(room1,HIGH);
}
}

mrtech2122:
when im ready to walk into
the other room i want that one to turn on is that possible ?

How is the system supposed to know when you are "ready" to walk into the room? PIR sensors can only detect motion, not a person's intent.

thats why i said i have two pir's ,for sensing motion in both rooms,i think you misunderstood

i wanted to know how to use two pir's ,for detecting motion in each room
i want one to switch a light on in one room,and the other pir in the other room
i have one room setup
but,i dont know how to setup the sketch to add the other room

mrtech2122:
thats why i said i have two pir's ,for sensing motion in both rooms,i think you misunderstood

Actually, you said you to turn the other light on when you were "ready to walk into the other room", hence the comment of the sensor not knowing when you're "ready".

but,i dont know how to setup the sketch to add the other room

Same as you did with the first one, just different pins to read and write to.

can you teach,or show me how its supposed to be written?

To get it working in the crudest possible way, copy the code in loop (all six lines of it) and paste it after those six lines. Change every 1 in the new piece to a 2. Fix the compilation errors you get, which will mean declaring the motion pin for room two. Don't forget to set it's pinmode. That should do it.

It'll work poorly because of the delays, but it'll get you started I hope.