Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
SURYATEJA
Published © Apache-2.0

Arduino Light Senser Using LDR

This project uses LDR for a light sensor.

BeginnerFull instructions provided1.5 hours2,502
Arduino Light Senser Using LDR

Things used in this project

Story

Read more

Custom parts and enclosures

CONNECTIONS

Schematics

CONNECTIONS

Code

CODE FOR LDR

Arduino
void setup() {
  Serial.begin(9600); // Start Serial.
  pinMode(13, OUTPUT);
}

void loop() {
  int A = analogRead(A0);
  Serial.println(A);// Display serial results in serial monitor.
  if (A < 100 ) {   // Change 100 to the number depending on the light in your area.
    digitalWrite(13, HIGH);
  }

  else {
    digitalWrite(13, LOW);
  }


}

Credits

SURYATEJA

SURYATEJA

18 projects • 59 followers

Comments