#define ldr A0
#define led 2
int vldr=0;
void setup()
{
// put your setup code here, to run once:
pinMode(ldr, INPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
vldr=analogRead(ldr);
if (vldr<150)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
Serial.println(vldr);
delay(100);
}