int ldrPin = A0;
int ledPin = 11;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int ldrValue = analogRead(ldrPin);
Serial.print("value : ");
Serial.println(ldrValue);
delay(1000);
if(ldrValue > 500) {
digitalWrite(ledPin, HIGH);
Serial.println("led status : on");
} else {
digitalWrite(ledPin, LOW);
Serial.println("led status : off");
}
}