//Q-13 Write a program to interface LED at PWM pin and LDR, in such a way that when the
//light intensity falling on LDR rises the LED glow should be reduced and after a
//threshold value the LED should be put off. (representing smart street light concept)
int led=11;
int ldr=A0;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
pinMode(ldr,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int data=analogRead(ldr);
Serial.println(data);
if(data<=250)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led,LOW);
}
delay(1000);
}