How to use LDR with relay module in Arduino :
Full video link with description:
Code :
void setup() {
pinMode(4,INPUT);
pinMode(3,OUTPUT);
digitalWrite(4,HIGH);
// put your setup code here, to run once:
}
void loop() {
if (digitalRead(4) == HIGH){
digitalWrite(3,LOW);
}
else{
digitalWrite(3,HIGH);
}}
// put your main code here, to run repeatedly: