#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int REED = 4;
int LED = 8;
int LED2 = 6;
int x = 9;
LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
void setup()
{
pinMode(LED2, INPUT);
Serial.begin(9600); // Used to type in characters
lcd.begin(20,4); // initialize the lcd for 20 chars 4 lines and turn on backlight
lcd.backlight(); // finish with backlight on
lcd.setCursor(3,0); //Start at character 4 on line 0
lcd.print("Hello");
delay(500);
}
void loop()
{
lcd.home ();
lcd.clear();
int ledState;
int x;
ledState = digitalRead(LED2);
if (ledState==HIGH) x=5;
else x=0;
lcd.setCursor ( 0, 2 );
lcd.print (x);
delay (200);
}