#include <Wire.h> 
#include <LiquidCrystal_I2C_Hangul.h>
LiquidCrystal_I2C_Hangul lcd(0x27,16,2);
//#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x27,16,2);

int secBtn      = 10;
int asagiBtn    = 9;
int yukariBtn   = 8;
int kirmiziLed  = 7;
int maviLed     = 6;
int sariLed     = 5;
int yesilLed    = 4;

int menu        = 1;
int kirmiziSayac= 0;
int maviSayac   = 0;
int sariSayac   = 0;
int yesilSayac  = 0;


void setup()
{
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();

  pinMode(secBtn,     INPUT_PULLUP);
  pinMode(asagiBtn,   INPUT_PULLUP);
  pinMode(yukariBtn,  INPUT_PULLUP);
  pinMode(kirmiziLed, OUTPUT);
  pinMode(maviLed,    OUTPUT);
  pinMode(sariLed,    OUTPUT);
  pinMode(yesilLed,   OUTPUT);

  lcd.clear();
  lcd.setCursor(2, 0);
  lcd.print("aysubey.com");
  lcd.setCursor(2, 1);
  lcd.print("BASIT MENU");
  delay(500);
}

void loop()
{
  if (!digitalRead(asagiBtn)){
    menu++;
    guncelMenu();
    delay(100);
    while (!digitalRead(asagiBtn));
  }
  if (!digitalRead(yukariBtn)){
    menu--;
    guncelMenu();
    delay(100);
    while(!digitalRead(yukariBtn));
  }
  if (!digitalRead(secBtn)){
    aksiyonuUygula();
    guncelMenu();
    delay(100);
    while (!digitalRead(secBtn));
  }  
}

void guncelMenu() {
  switch (menu) {
    case 0:
      menu = 1;
      break;
    case 1:
      lcd.clear();
      lcd.print(">Kirmizi Led");
      lcd.setCursor(0, 1);
      lcd.print(" Mavi Led");
      break;
    case 2:
      lcd.clear();
      lcd.print(" Kirmizi Led");
      lcd.setCursor(0, 1);
      lcd.print(">Mavi Led");
      break;
    case 3:
      lcd.clear();
      lcd.print(">Sari Led");
      lcd.setCursor(0, 1);
      lcd.print(" Yesil Led");
      break;
    case 4:
      lcd.clear();
      lcd.print(" Sari Led");
      lcd.setCursor(0, 1);
      lcd.print(">Yesil Led");
      break;
    case 5:
      menu = 4;
      break;
  }
}

void aksiyonuUygula() {
  switch (menu) {
    case 1:
      aksiyon1();
      break;
    case 2:
      aksiyon2();
      break;
    case 3:
      aksiyon3();
      break;
    case 4:
      aksiyon4();
      break;
  }
}

void aksiyon1() {
  lcd.clear();
  lcd.print("Kirmizi Yandi");
  digitalWrite(kirmiziLed, HIGH);
  kirmiziSayac++;

  if(kirmiziSayac == 2){
    lcd.clear();
    lcd.print("Kirmizi Kapandi");
    digitalWrite(kirmiziLed, LOW);
    kirmiziSayac = 0;
  }
  else{
    digitalWrite(kirmiziLed, HIGH);
  }
  delay(1500);
}

void aksiyon2() {
  lcd.clear();
  lcd.print("Mavi Yandi");
  digitalWrite(maviLed, HIGH);
  maviSayac++;

  if(maviSayac == 2){
    lcd.clear();
    lcd.print("Mavi Kapandi");
    digitalWrite(maviLed, LOW);
    maviSayac = 0;
  }
  else{
    digitalWrite(maviLed, HIGH);
  }
  delay(1500);
}

void aksiyon3() {
  lcd.clear();
  lcd.print("Sari Yandi");
  digitalWrite(sariLed, HIGH);
  sariSayac++;

  if(sariSayac == 2){
    lcd.clear();
    lcd.print("Sari Kapandi");
    digitalWrite(sariLed, LOW);
    sariSayac = 0;
  }
  else{
    digitalWrite(sariLed, HIGH);
  }
  delay(1500);
}

void aksiyon4() {
  lcd.clear();
  lcd.print("Yesil Yandi");
  digitalWrite(yesilLed,HIGH);
  yesilSayac++;

  if(yesilSayac == 2){
    lcd.clear();
    lcd.print("Yesil Kapandi");
    digitalWrite(yesilLed, LOW);
    yesilSayac = 0;
  }
  else{
    digitalWrite(yesilLed, HIGH);
  }
  delay(1500);
} 

void sabitEKRAN()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Kir : ");
  lcd.setCursor(5, 0);
  lcd.print("A");
  lcd.setCursor(8, 0);
  lcd.print("Sar : ");
  lcd.setCursor(13, 0);
  lcd.print("A");
  lcd.setCursor(0, 1);
  lcd.print("Mav : ");
  lcd.setCursor(5, 1);
  lcd.print("A");
  lcd.setCursor(8, 1);
  lcd.print("Yes : ");
  lcd.setCursor(13,1);
  lcd.print("A");
  delay(5000);

}
$abcdeabcde151015202530354045505560fghijfghij