#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int button = 6;
const int buzzer = 9;
bool startGameState = false;
const String dino = "\1";
const String cactus = "\2";
byte dinoLogo[] = {
B00000,
B01100,
B10011,
B11100,
B01111,
B01100,
B01110,
B01100
};
byte CactusLogo[] = {
B00000,
B00100,
B10101,
B01110,
B11111,
B01110,
B10101,
B00100
};
void setup(){
lcd.init();
lcd.backlight();
pinMode(buzzer, OUTPUT);
pinMode(button, INPUT_PULLUP);
lcd.createChar(1, dinoLogo);
lcd.createChar(2, CactusLogo);
}
void loop(){
if(startGameState){
StartGame();
}else if(!startGameState && digitalRead(button) == HIGH){
lcd.home();
lcd.print("Pencet Untuk");
lcd.setCursor(0, 1);
lcd.print("Mulai ");
lcd.print(dino);
lcd.print(cactus);
}else if(!startGameState && digitalRead(button) == LOW){
startGameState = true;
}
delay(100);
lcd.clear();
}
void StartGame(){
lcd.setCursor(0, 1);
lcd.print(dino);
}