#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int ldr = A0;
int led = 13;
int led2 = 10;
int threshold = 500;
void setup() {
// put your setup code here, to run once:
pinMode(ldr, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
}
void loop() {
// put your main code here, to run repeatedly:
int ldrvalue = analogRead(A0);
lcd.println(ldrvalue );
if(ldrvalue <= threshold )
{
digitalWrite(13, HIGH);
digitalWrite(10, LOW);
}
else
{
digitalWrite(10, HIGH);
digitalWrite(13, LOW);
}
}