#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
#define LDR_PIN 2
void setup() {
pinMode(LDR_PIN, INPUT);
lcd.init();
lcd.backlight();
}
void Light_screen ()
{
lcd.print(" L i g h t ");
lcd.setCursor(0, 1); // x , y
lcd.print("+------------------+");
lcd.setCursor(0, 2); // x , y
lcd.print("| |");
lcd.setCursor(0, 3); // x , y
lcd.print("+------------------+");
}
void loop() {
Light_screen () ;
int light = analogRead(A0); // 0 ... 1023
lcd.setCursor(8, 2); // x , y
lcd.print(light);
lcd.print(" ");
if (100 > light)
tone(13, 262, 250); // Plays 262Hz tone for 0.250 seconds
delay(1000);
}