#include <LiquidCrystal.h>
#include <Keypad.h>
// Initialize LCD with correct pins
LiquidCrystal lcd(0, 2, 22, 26, 27, 28);
const byte ROW_NUM = 4; // Number of rows in the keypad
const byte COLUMN_NUM = 4; // Number of columns in the keypad
// Key mapping for the keypad
char keys[ROW_NUM][COLUMN_NUM] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
// Define row and column pins
byte pin_rows[ROW_NUM] = {11, 10, 9, 8};
byte pin_column[COLUMN_NUM] = {7, 5, 4, 3}; // Missing semicolon fixed
// Initialize keypad
Keypad keypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM);
void setup() {
lcd.begin(16, 2); // Set up LCD with 16x2 characters
lcd.clear(); // Clear LCD display
lcd.setCursor(0, 0);
lcd.print("Press a key:"); // Initial message
}
void loop() {
char key = keypad.getKey(); // Read key press
if (key) {
lcd.clear();
lcd.setCursor(0, 0);
// Respond to keypress
if (key == '1') {
lcd.print("Mutton Biriyani");
lcd.setCursor(0,1);
lcd.print("Rs.300");
} else if (key == '2') {
lcd.print("Chicken Biriyani");
lcd.setCursor(0,1);
lcd.print("Rs.250");
} else if (key == '3') {
lcd.print("parneer Biriyani");
lcd.setCursor(0,1);
lcd.print("Rs.270");
} else if (key == '4') {
lcd.print("Chicken 65");
lcd.setCursor(0,1);
lcd.print("Rs.250");
} else if (key == '5') {
lcd.print("chicken lolipop");
lcd.setCursor(0,1);
lcd.print("Rs.230");
} else if (key == '6') {
lcd.print("Chicken fried rice");
lcd.setCursor(0,1);
lcd.print("Rs.200");
} else if (key == '7') {
lcd.print("gobi rice");
lcd.setCursor(0,1);
lcd.print("Rs.150");
} else if (key == '8') {
lcd.print("veg rice");
lcd.setCursor(0,1);
lcd.print("Rs.100");
} else if (key == '9') {
lcd.print("Coco-cola");
lcd.setCursor(0,1);
lcd.print("Rs.20");
} else if (key=='C') {
lcd.clear();
}
}
}