LED/Light Control using LDR
This Project Will demonstrate you to automate your lights using LDR. Like if there is a no light in your room, your Led/Bulb will trun on Automatically.
Hardware Required:
1x Arduino Uno
1x LDR
1x 5MM Led (any Color)
1x Bread board & some Jumpire Wires M-M
1x 10k Resistor
Want to Buy Complete Kit Click Here
Arduino Pin Layout:
Code:
/*
* OR97 Arduino Maker Basic Kit
* Project#6 LED/Light Control using LDR.
* Made By: OR97 Team
* Kit Link=https://www.or97.com/arduino-maker-basic-kit
*/
int LDRPin=A0;
int LEDPin=7;
void setup() {
Serial.begin(9600);
pinMode(LDRPin,INPUT);
pinMode(LEDPin,OUTPUT);
}
void loop() {
float LDRValue=analogRead(LDRPin);
Serial.println(LDRValue);
if(LDRValue<300)
digitalWrite(LEDPin,HIGH);
else
digitalWrite(LEDPin,LOW);
delay(500);
}