int ledPin=12;
int ldrPin=A0;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin,OUTPUT);
pinMode(ldrPin,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int ldrStatus=analogRead(ldrPin);
if(ldrStatus <=300)
{
digitalWrite(ledPin,HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}