/*
************************
************************
** Name: Alex Szabo **
** Prog: Lab test **
** Date: oct 22 **
** Desc: LED with **
** LCD screen **
** **
************************
************************
*/
int buttonPin = 2; // button is an input
int redLed = 8; // red led
#define I2C_ADDR 0x27 // set up the ip adress
#define LCD_COLUMNS 16 // assigns number of columns for ldc display
#define LCD_LINES 2 // asssigns number of lines for lcd display
LiquidCrystal_I2C lcd (I2C_ADDR, LCD_COLUMNS, LCD_LINES); // assigns set values for lcd display
void setup() {
lcd.init(); // set interface to lcd screen
lcd.backlight(); // turn on back light
lcd.setCursor(0, 0); // set cursor to (0,0)
pinMode(redLed, OUTPUT); // red led output
pinMode(buttonPin, INPUT_PULLUP); // sets button to INPUT PULLUP
attachInterrupt(digitalPinToInterrupt(buttonPin), menuOption(), FALLING); //attatch button interupt
digitalRead(buttonPin, HIGH); // makes button an input
} // end setup
void loop() {
if (1 == 1) lcd.print("MAIN MENU"); // print Main Menu
lcd.setCursor(9, 1); // set cursor to (0,0)
digitalWrite(redLed, LOW); // LED off
if (1 ==2) lcd.print("START Menu"); // print START Menu
lcd.setCursor(9, 1); // set cursor to (0,0)
digitalWrite(redLed, LOW); // LED off
if (1 ==3) lcd.print("PLY MENU"); // print PLY Menu
lcd.setCursor(7, 1); // set cursor to (0,0)
digitalWrite(redLed, LOW); // LED off
if (1 == 4) lcd.print("WINNER MENU"); // print WINNER Menu
lcd.setCursor(11, 1); // set cursor to (0,0)
digitalWrite(redLed, LOW); //LED off
if (1 == 5) lcd.print("GAMEOVER MENU"); // print GAMEOVER Menu
lcd.setCursor(13, 1); // set cursor to (0,0)
digitalWrite(redLed, HIGH); //LED on
} // end loop