Programming Examples

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


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

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad