//Progam Menyalakan lampu dengan Arduino
//by Febby Liyanna
//Kelas X RPL 3
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int sensor;
int paimon = 7;


void setup() {
  lcd.init ();
  lcd.backlight();
  lcd.clear();

  pinMode(5,INPUT);
  pinMode(7, INPUT);
  pinMode(3, INPUT_PULLUP);

  lcd.setCursor(3,0);
  lcd.print("WELCOME TO");

  lcd.setCursor(3,1);
  lcd.print("MY PROJECT");

  delay(2000);

  lcd.clear();
}

void loop() {
 sensor = digitalRead(A3);
 if(sensor == 1){
   digitalWrite(paimon, HIGH);
   lcd.setCursor(3,0);
   lcd.print("Lampu");
   lcd.setCursor(2,1);
   lcd.print("Nyala");
 }
 else if(sensor == 0){
   digitalWrite(paimon, LOW);
   lcd.setCursor(3,0);
   lcd.print("Lampu");
   lcd.setCursor(2,1);
   lcd.print("Mati ");
 }
}