int ldrPin = A0;
int ledPin = 9;
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);
if(ldrValue > 500){
digitalWrite(ledPin, HIGH);
}else{
digitalWrite(ledPin, LOW);
}
delay(200);
}