#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
int btn = 28;
int led = 23;
void setup() {
// put your setup code here, to run once:
pinMode(btn, INPUT);
pinMode(led, OUTPUT);
lcd.begin(16,2);
}
void loop() {
int btnlow = digitalRead(btn);
if(btnlow == LOW)
{
lcd.setCursor(0,0);
lcd.print("Switch is ON");
lcd.setCursor(0,1);
lcd.print("LED is On");
digitalWrite(led, HIGH);
delay(500);
lcd.clear();
}
else
{
lcd.setCursor(0,0);
lcd.print("Switch is OFF");
lcd.setCursor(0,1);
lcd.print("LED is OFF");
digitalWrite(led, LOW);
delay(500);
lcd.clear();
}
}
// put your main code here, to run repeatedly: