Programming Examples
Arduino program to create automatic street light control by using LDR sensor

Arduino program to create automatic street light control by using LDR sensor.
Automatic Street light Control is used to control the street lights (Turn on and off based on the light). Here we make use of LDR (Light Dependent Resistor) and LED (Light Emitting diode) and Arduino.
Hardware Component Required :
- LDR
- LED
- Resistor
- Bread board
- Connecting Wires
- Arduino
Solution
void setup()
{
pinMode(13,OUTPUT);
pinMode(A0,INPUT);
Serial.begin(9600);
}
void loop()
{
int signal;
signal=analogRead(A0);
Serial.println(signal);
if(signal<400)
{
Serial.println("LED Light On");
digitalWrite(13,HIGH);
}
else
{
Serial.println("LED Light OFF");
digitalWrite(13,LOW);
}
delay(10);
}
Output
Hear LDR is used to detect the light and Arduino is used to ON/OFF the LED Light