#include <LiquidCrystal.h>
const int rs=15,en=4, d4=13,d5=12,d6=14,d7=27;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
boolean state;
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
pinMode(18, OUTPUT);
pinMode(33, INPUT);
Serial.begin(9600);
}
void loop()
{
state=digitalRead(33);
Serial.println(state);
delay(800);
if (state ==HIGH)
{
digitalWrite(18, HIGH);
lcd.setCursor(0,0);
lcd.print("NIGHT");
delay(500);
//lcd.clear();
// lcd.setCursor(0,0);
lcd.print(" ");
}
else
{
digitalWrite(18, LOW);
lcd.setCursor(0,0);
lcd.print("Day");
delay(500);
lcd.clear();
//lcd.print(" ");
}
}