#define PIR 34
int LDRPin = 35;
int pirState = 0;
int LDRValue = 0;
void setup() {
Serial.begin(9600);
pinMode(PIR, INPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
}
void loop() {
LDRValue = analogRead(LDRPin);
pirState = digitalRead(PIR);
if (pirState == HIGH) {
digitalWrite(18, HIGH);
delay(100);
}
else if (pirState == LOW) {
digitalWrite(18, LOW);
delay(100);
}
if (LDRValue < 1750) {
digitalWrite(19, LOW);
delay(100);
}
else if (LDRValue > 2045) {
digitalWrite(19, HIGH);
delay(100);
}
else {
digitalWrite(19, HIGH);
}
}