use PIR sensor to control to control a bulb with relay but it dose not respons with the sensor

2018-03-21 16:44:31

I use PIR sensor to detect the movement and turn on the bulb

PIR sensor work properly but bulb does not respond to it .

here is the code

int irmotionPin = 4; // Pin of IR Motion Sensor

int relayPin = 8; // Pin of Relay Module

void setup()

{

Serial.begin(9600);

pinMode(relayPin, OUTPUT); // Set Pin connected to Relay as an OUTPUT

digitalWrite(relayPin, LOW); // Set Pin to LOW to turn Relay OFF

}

void loop()

{

while (digitalRead(irmotionPin) == HIGH)

{

digitalWrite(relayPin, HIGH);

Serial.println("Relay is ON");

delay(500);

}

digitalWrite(relayPin, LOW);

Serial.println("Relay is OFF");

delay(500);

}