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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz