LDR
Photoresistors, also known as light dependent resistors (LDR), are light sensitive devices most often used to indicate the presence or absence of light, or to measure the light intensity. In the dark, their resistance is very high, sometimes up to 1MΩ, but when the LDR sensor is exposed to light, the resistance drops dramatically, even down to a few ohms, depending on the light intensity
PROGRAM
int LDR = 2;
int LED = 13; // connect Led to arduino pin 13
void setup()
{
pinMode (LDR, INPUT); // sensor pin INPUT
pinMode (LED, OUTPUT); // Led pin OUTPUT
}
void loop()
{
int LDR = digitalRead (IRSensor);
if (LDR == 1)
{
digitalWrite(LED, LOW); // LED LOW
}
else
{
digitalWrite(LED, HIGH); // LED High
}
}
