#include <LiquidCrystal_I2C.h>
#define SIG 4
#define LED_BUILTIN 5
int LED_STATE = LOW;
//bool user = false;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
Serial.begin(115200);
pinMode(SIG , OUTPUT);
pinMode(LED_BUILTIN , OUTPUT);
lcd.init();
lcd.backlight();
//Serial.available(user = 1);
}
void loop() {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Welcome");
delay(1000);
int analogeValue = (SIG);
lcd.clear();
if (analogeValue > 2000){
lcd.setCursor(0,1);
lcd.print("Light is OFF");
if(LED_STATE = (LOW)){
LED_STATE = (HIGH);
}
delay(1000);
}
else{
lcd.setCursor(0,1);
lcd.print("Light is ON");
if(LED_STATE = (HIGH)){
LED_STATE = (LOW);
}
}
//
// lcd.print("Goodbye");
delay(1000); // this speeds up the simulation
}