#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
//button inputs for set up
int button1 = 2;
int button2 = 3;
int button3 = 4;
int button4 = 5;
//button input for loop
int b1,b2,b3,b4;
int gs;
int gamestate =0;
// Death Clicks Variables
int count = 0;
int press;
// KotH Timer Variables
long hour = 1, minute = 59, second = 59;
long countdown_time = (hour * 3600) + (minute * 60) + second;
long pause = 0, pause_start = 0;
const int indication = 10;
int exitloop = 0;
//register inputs
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.begin(16,2);
pinMode(button1,INPUT);
pinMode(button2,INPUT);
pinMode(button3,INPUT);
pinMode(button4,INPUT);
}
void loop()
{
b1 = digitalRead(button1);
b2 = digitalRead(button2);
b3 = digitalRead(button3);
b4 = digitalRead(button4);
gs = gamestate;
if (b4 == HIGH)
{
gs = 1;
}
if (b4 == LOW )
{
gs = gamestate = 0;
}
switch (gs)
{
case 0:
if((b1 == HIGH) || (b2 == HIGH))
{
press=count++;
delay(250);
}
if (b3 == HIGH)
{
press=count=0;
lcd.setCursor(0,1);
lcd.print(press);
lcd.print(" ");
delay(250);
}
lcd.setCursor(0,0);
lcd.print("Death Count "); // extra spaces to clear out screen instead of clear
lcd.setCursor(0,1);
lcd.print(press);
break;
case 1:
lcd.setCursor(0,0);
lcd.print("case 2 ");
lcd.setCursor(0,1);
lcd.print(gs);
break;
}
}