Circuit Diagram:-
Code:-
int PIR = 2;
int Bulb = 13;
int fan = 12;
int value = 0;
void setup()
{
pinMode(2,INPUT);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop()
{
value=digitalRead(PIR);
if(value==HIGH)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
delay(5000);
}
else
{digitalWrite(13,LOW);
digitalWrite(12,LOW);
}
}
No comments:
Post a Comment