// Photoresistors | Light Dependent Resistors
int LED = 13;
int LDRpin = A0;
void setup(){
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
pinMode(LDRpin, INPUT);
Serial.begin(9600);
}
void loop(){
// put your main code here, to run repeatedly:
int sensorValue = analogRead(LDRpin);
//lux, unit of illumination (see luminous intensity) in the International System of Units (SI).
if(sensorValue <= 40){ // compare sensorThreshhold value
Serial.print("light source and the area luminous power(lux) is very low : ");
Serial.println(sensorValue);
digitalWrite(LED, HIGH);
}
else{
Serial.print("The area luminous power(lux) is : ");
Serial.println(sensorValue);
digitalWrite(LED, LOW);
}
delay(1000); // Wait for 1000 millisecond(s)
}