Arduino - LDR

In this Project, we will see about how to interface LDR with Arduino and can control an LED.

Circuit Diagram:

Arduino Code:
ldr_code.ino
//This Code is Developed by Sdev
//Follow Us Here : https://youtube.com/sdevelectronics

#define ldrpin A0
#define ledpin 13

int ldrvalue;

void setup() {
  Serial.begin(9600);
  pinMode(ledpin,OUTPUT);
}

void loop() {
  ldrvalue = analogRead(ldrpin);
  Serial.println(ldrvalue);
  if(ldrvalue<900){
    digitalWrite(ledpin,HIGH);
  }else{
    digitalWrite(ledpin,LOW);
  }
  delay(100);
}

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

No comments:

Post a Comment