here is my project instrument List
- Arduino Nano
- 9 LED
- PIR Motion Sensor
- 5V relay
- 220V AC Light Bulb
**I Want to turn on the 220V AC Light bulb for one hour when PIR Motion Sensor Detects any Human , while the bulb is turn on for one hour i want to blink that 9 LED also high low high low for one HOUR **
int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int led5 = 6;
int led6 = 7;
int led7= 8;
int led8= 9;
int led9 = 10;
int relay = 13;
int pin = A2;
int value = 0;
int pirState = LOW;
const unsigned long even_1 = 43000;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(relay, OUTPUT);
pinMode(pin, INPUT);
Serial.begin(9600);
}
void loop() {
value = digitalRead(pin);
if (value == HIGH)
{
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
digitalWrite(led8, HIGH);
digitalWrite(led9, HIGH);
digitalWrite(relay, LOW);
delay(1800000);
}
if (value == LOW)
{
digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led1, LOW);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led2, LOW);
delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led3, LOW);
delay(100);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led4, LOW);
delay(100);
digitalWrite(led5, HIGH);
delay(100);
digitalWrite(led5, LOW);
delay(100);
digitalWrite(led6, HIGH);
delay(100);
digitalWrite(led6, LOW);
delay(100);
digitalWrite(led7, HIGH);
delay(100);
digitalWrite(led7, LOW);
delay(100);
digitalWrite(led8, HIGH);
delay(100);
digitalWrite(led8, LOW);
delay(100);
digitalWrite(led9, HIGH);
delay(100);
digitalWrite(led9, LOW);
delay(100);
digitalWrite(relay, HIGH);
}
}