int LdrPin = A0;
int LedPin = 13;
int threshold = 500;
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.println(LdrValue);
if (LdrValue < threshold) {
digitalWrite(LedPin , HIGH);
}
else {
digitalWrite(LedPin , LOW);
}
delay(1000);
}