#include <Keypad.h> // library for keypad

#include <LiquidCrystal.h>// library for LCD

int btn1 = 9;// the pin our push button is on
int btn2 = 10;
int btn3 = 11;
int btn4 = 12;

/* Keypad setup */
const byte KEYPAD_ROWS = 4;
const byte KEYPAD_COLS = 4;
byte rowPins[KEYPAD_ROWS] = {13, 8, 7, 6};
byte colPins[KEYPAD_COLS] = {A5, A4, A3, A2};
char keys[KEYPAD_ROWS][KEYPAD_COLS] = {
  {'1', '2', '3', '+'},
  {'4', '5', '6', '-'},
  {'7', '8', '9', '*'},
  {'.', '0', '=', '/'}
};

Keypad myKeypad = Keypad(makeKeymap(keys), rowPins, colPins, KEYPAD_ROWS, KEYPAD_COLS);

boolean present = false;
String num1, num2; 


// const int btn5 = 13;
// const int btn6 = A5;

int buttonval1 = 0;



LiquidCrystal lcd2(A1, A0, 5, 4, 3, 2);// Arduino pins for LCD

void setup() {
   lcd2.begin(20,4);
   
   lcd2.setCursor(0,0);
   lcd2.print("Welcome to ");
   lcd2.setCursor(0,1);
   lcd2.print("Shri Saimeera Labs");
   delay(3000);
   lcd2.clear();
   lcd2.setCursor(0,0);
   lcd2.print("liquid 1 ");
   lcd2.setCursor(0,1);
   lcd2.print("Liquid 2 ");
   lcd2.setCursor(0,2);
   lcd2.print("Liquid 3 ");
   lcd2.setCursor(0,3);
   lcd2.print ("Liquid 4 ");
   lcd2.setCursor(9,3);
   lcd2.print("Select");
   lcd2.setCursor(15,3);
   lcd2.cursor();
 
 

 pinMode(btn1, INPUT);
pinMode(btn2, INPUT);
pinMode(btn3, INPUT);
pinMode(btn4, INPUT);
// pinMode(btn5, INPUT_PULLUP);
// pinMode(btn6, INPUT_PULLUP);


// int liquidval1 = digitalRead(btn1);
//    int liquidval2 = digitalRead(btn2);
//   int liquidval3 = digitalRead(btn3);
//   int liquidval4 = digitalRead(btn4);






  
 
}

   // put your main code here, to run repeatedly:
   
void loop() 
{

int liquidval1 = 0;
int liquidval2 = 0;
int liquidval3 = 0;
int liquidval4 = 0;



liquidval1 = digitalRead(btn1);
liquidval2 = digitalRead(btn2);
liquidval3 = digitalRead(btn3);
liquidval4 = digitalRead(btn4);







if (liquidval1 == HIGH) {
   lcd2.clear();
   lcd2.print("Liquid 1 Selected");
   delay(100);
   lcd2.setCursor(0,1);
   lcd2.print(" Enter Qty: ");
   delay(100);
}
//   getKey(key1);
//   lcd2.setCursor(0, 2); /* decaling the place where the first entry will be displayed*/
//   lcd2.print(key1); // printing the first number entered





else if (liquidval2 == HIGH) {
   lcd2.clear();
   lcd2.print("Liquid 2 Selected");
   delay(100);
   lcd2.setCursor(0,1);
   lcd2.print(" Enter Qty: ");
   delay(100);
 }    
else if (liquidval3 == HIGH) {
  lcd2.clear();
  lcd2.print("Liquid 3 Selected");
  delay(100);
   lcd2.setCursor(0,1);
   lcd2.print(" Enter Qty: ");
   delay(100);

 }
else if (liquidval4 == HIGH) {
  lcd2.clear();
  lcd2.print("Liquid 4 Selected");
  delay(100);
   lcd2.setCursor(0,1);
   lcd2.print(" Enter Qty: ");
   delay(100);
}
//else {
  // lcd2.print("Select 1 to 4");
   //delay(100);
//}

}
 

void getKey(char key1){

   char keys = myKeypad.getKey();
  // if (key != NO_KEY && (key=='1'||key=='2'||key=='3'||key=='4'||key=='5'||key=='6'||key=='7'||key=='8'||key=='9'||key=='0'))// check which key is pressed by checking its integer value
  // {
    // if (present != true)
    //{
     // num1 = num1 + key; // storing the value of key pressed in num1
      // float numLength = num1.length();
      //lcd2.setCursor(0, 2); /* decaling the place where the first entry will be displayed*/
      //lcd2.print(key); // printing the first number entered
      return(key1);
  //  }



 // }

}