SURYATEJA
Published © Apache-2.0

Automatic Street Light Controller

The streetlight is controlled by using the LDR sensor.

BeginnerFull instructions provided82,158
Automatic Street Light Controller

Things used in this project

Story

Read more

Custom parts and enclosures

automatic street light controller

Schematics

automatic street light controller

Code

automatic street light controller

Arduino
#include <SoftwareSerial.h>

int sensorPin = A0; // select the input pin for the LDR

int sensorValue = 0; // variable to store the value coming from the sensor

int led = 3;

void setup() { // declare the ledPin as an OUTPUT:

pinMode(led, OUTPUT);

Serial.begin(9600); }

void loop()

{

Serial.println("Welcome to TechPonder LDR Tutorial");

sensorValue = analogRead(sensorPin);

Serial.println(sensorValue);

if (sensorValue < 100)

{

Serial.println("LED light on");

digitalWrite(led,HIGH);

delay(1000);

}

digitalWrite(led,LOW);

delay(sensorValue);

}

Credits

SURYATEJA

SURYATEJA

18 projects • 59 followers

Comments