#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change the I2C address if necessary (0x27 is common for 16x2 displays)
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; // Connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; // Connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("RAYAN'S CAFE");
lcd.setCursor(0, 1);
lcd.print("Select item:");
delay(3000);
// Items in the coffee shop
String items[] = {
"Espresso ",
"Latte ",
"Cappuccino ",
"NESCAFE ",
"MILK SHAKE ",
"Croissant ",
"Cocktail ",
"Cookie ",
"Sandwich ",
"JUICE ",
"CREPE ",
};
// Display items by scrolling
for (int i = 0; i < 12; ++i) {
for (int j = 0; j < 16; ++j) {
lcd.clear();
lcd.setCursor(j, 1);
lcd.print(items[i]);
delay(150);
}
}
lcd.setCursor(0,1);
lcd.print("PRESS ANY KEY");
delay(3000);
}
void loop() {
char key = keypad.getKey();
if (key != NO_KEY && (key == '1' || key == '2' || key == '3' || key == '4'|| key == '5' || key == '6' || key == '7' || key == '8'|| key == '9' || key == 'A' || key == 'B' )) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Item selected:");
switch (key) {
case '1':
lcd.setCursor(0, 1);
lcd.print("Espresso ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '2':
lcd.setCursor(0, 1);
lcd.print("Latte ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '3':
lcd.setCursor(0, 1);
lcd.print("Cappuccino ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '4':
lcd.setCursor(0, 1);
lcd.print("NESCAFE ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '5':
lcd.setCursor(0, 1);
lcd.print("MILK SHAKE ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '6':
lcd.setCursor(0, 1);
lcd.print(" Croissant ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '7':
lcd.setCursor(0, 1);
lcd.print(" Cocktail ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '8':
lcd.setCursor(0, 1);
lcd.print(" Cookie ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case '9':
lcd.setCursor(0, 1);
lcd.print(" Sandwich ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case 'A':
lcd.setCursor(0, 1);
lcd.print(" JUICE ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
break;
case 'B':
lcd.setCursor(0, 1);
lcd.print(" CREPE ");
delay(3000);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("THANKS FOR VISIT ");
default:
break;
}
}
}