Skip to content

Instantly share code, notes, and snippets.

@RobolinkAkademi
Last active October 28, 2019 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobolinkAkademi/e0bdaa01cc883f9d8291672420f494ee to your computer and use it in GitHub Desktop.
Save RobolinkAkademi/e0bdaa01cc883f9d8291672420f494ee to your computer and use it in GitHub Desktop.
tum_yil_icin_arduino_mufredati_28
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
const int switchPin=6;//eğim anahtarına takılı pinler
int switchState=0;
int prevSwitchState=0;
int reply;
void setup() {
lcd.begin();
pinMode(switchPin,INPUT);
lcd.print("Bir Soru Sor");
}
void loop() {
switchState=digitalRead(switchPin);//eğim anahtarı pinini oku
if(switchState!=prevSwitchState)
{
if(switchState==LOW)//devre bozulursa cevap ver
{reply=random(8);//cevap aşağıdaki 8 rastgele durrumun bir tanesidir
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Cevap: ");//bunu ekrana yazdır
lcd.setCursor(0,1);
switch(reply){//yanıt aşağıdakilerden biri olacaktır.
case 0:
lcd.print("Evet");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 1:
lcd.print("Muhtemelen");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 2:
lcd.print("Kesinlikle");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 3:
lcd.print("Aptal Olma");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 4:
lcd.print("Tabiki");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 5:
lcd.print("Tekrar Sor");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 6:
lcd.print("Kararsiz");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
case 7:
lcd.print("Hayir");
delay(3000);
lcd.clear();
lcd.print("Bir Soru Sor");
break;
}
}
}
prevSwitchState=switchState;//anahtarı 0la
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment