int ldrPin = 34;
int relayPin = 22; int buttonPin = 35;
int relayPin1 = 19;
void setup() {
pinMode(relayPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
pinMode(relayPin1, OUTPUT);
Serial.begin(115200);
}
void loop() {
int buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite(relayPin1, HIGH);
} else {
digitalWrite(relayPin1, LOW);
}
delay(1000);
int ldrValue = analogRead(ldrPin);
Serial.println(ldrValue);
if (ldrValue < 2000) {
digitalWrite(relayPin, HIGH);
} else {
digitalWrite(relayPin, LOW);
}
delay(1000);
}