-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduio_code
57 lines (57 loc) · 1.05 KB
/
arduio_code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <LiquidCrystal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int LED1=6;
int LED2=7;
int IR1=8;
int IR2=10;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
Serial.begin(9600);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalRead(8);//IR1
digitalRead(9);//IR2
lcd.begin(16, 2);
lcd.clear();
lcd.print("LIGHT");
delay(1000);
lcd.setCursor(0,1);
lcd.print("MONITOR SYSTEM");
delay(1000);
lcd.clear();
}
void loop()
{
while(1)
{
if(digitalRead(IR1) ==LOW)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("PERSON1 DETECTED");
delay(1000);
digitalWrite(LED1,HIGH);
delay(1000);
}
if(digitalRead(IR2) ==LOW)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("PERSON2 DETECTED");
delay(1000);
digitalWrite(LED2,HIGH);
delay(1000);
}
else
{
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
delay(100);
}
}
}