IR

int IRSensor = 2; // connect ir sensor to arduino pin 2
int LED = 13; // connect Led to arduino pin 13

void setup()
{
pinMode (IRSensor, INPUT); // sensor pin INPUT
pinMode (LED, OUTPUT); // Led pin OUTPUT
}

void loop()
{
int statusSensor = digitalRead (IRSensor);

if (statusSensor == 1)
{
digitalWrite(LED, LOW); // LED LOW
}

else
{
digitalWrite(LED, HIGH); // LED High
}

}

PIR

int pirPin = 2;
int ledPin = 13;
int state;

void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop(){
state = digitalRead(pirPin);
Serial.println(state);

if (state == HIGH){
digitalWrite(ledPin, HIGH);
}

else{
digitalWrite(ledPin,LOW);
}
}