#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f, 16, 2);
int buton1 = 2;
int buton2 = 3;
int buton3 = 4;
int buton4 = 5;
int buton5 = 6;
int led1 = 8;
int led2 = 9;
int led3 = 10;
int led4 = 11;
int buton1durumu=0;
int buton2durumu=0;
int buton3durumu=0;
int buton4durumu=0;
int buton5durumu=0;
int btnDeger=0;
void setup()
{
lcd.begin();
pinMode(buton1 , INPUT);
pinMode(buton2 , INPUT);
pinMode(buton3 , INPUT);
pinMode(buton4 , INPUT);
pinMode(buton5 , INPUT);
pinMode(led1 , OUTPUT);
pinMode(led2 , OUTPUT);
pinMode(led3 , OUTPUT);
pinMode(led4 , OUTPUT);
}
void loop()
{
buton1durumu = digitalRead(buton1);
buton2durumu = digitalRead(buton2);
buton3durumu = digitalRead(buton3);
buton4durumu = digitalRead(buton4);
buton5durumu = digitalRead(buton5);
if (buton1durumu == HIGH)
digitalWrite(led1 , HIGH);
lcd.clear();
btnDeger=1;
}
else if (buton2durumu == HIGH)
{
digitalWrite(led1 , LOW);
digitalWrite(led2 , HIGH)
lcd.clear();
btnDeger=2;
}
else if (buton3durumu == HIGH)
{
digitalWrite(led1 , LOW);
digitalWrite(led2 , LOW);
digitalWrite(led3 , HIGH);
lcd.clear();
btnDeger=3;
}
else if (buton4durumu == HIGH)
{
digitalWrite(led1 , LOW);
digitalWrite(led2 , LOW);
digitalWrite(led3 , LOW);
digitalWrite(led4 , HIGH);
lcd.clear();
btnDeger=4;
}
else if (buton5durumu == HIGH)
{
digitalWrite(led1 , HIGH);
delay(500);
digitalWrite(led1 , LOW);
digitalWrite(led2 , HIGH);
delay(500);
digitalWrite(led2 , LOW);
digitalWrite(led3 , HIGH);
delay(500);
digitalWrite(led3 , LOW);
digitalWrite(led4 , HIGH);
delay(500);
digitalWrite(led4 , LOW);
}
switch (btnDeger) {
case 0:
lcd.setCursor(0, 0);
lcd.print("GOKMEN");
lcd.setCursor(0,1);
lcd.print("ELEKTRONIK");
break;
case 1:
lcd.setCursor(0, 0);
lcd.print("MOD_1");
lcd.setCursor(0, 1);
lcd.print ("SOLA GIT");
break;
case 2:
lcd.setCursor(0, 0);
lcd.print("MOD_2");
lcd.setCursor(0, 1);
lcd.print ("SAGA GIT ");
break;
case 3:
lcd.setCursor(0, 0);
lcd.print("MOD_3");
lcd.setCursor(0, 1);
lcd.print ("YUKARI GIT");
break;
case 4:
lcd.setCursor(0, 0);
lcd.print("MOD-4");
lcd.setCursor(0, 1);
lcd.print ("ASAGI GIT ");
break;
default:
lcd.setCursor(0, 0);
lcd.print("LCD");
lcd.setCursor(0,1);
lcd.print("Butonlar");
break;
}
}