this is the code I have right now. if you look through the code you will see that I have used waitForkey command because when I used the getKey command its do not allow me to enter the job number and time.
#include <Wire.h>
#include “DFRobot_RGBLCD.h”
#include <Keypad.h>
#define MachineNumber 9
#define TimeInMinutes 4 // to user must convert hours to minutes before entering
char Machine[MachineNumber] = {‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’};
char Minutes[TimeInMinutes];
char JobNumber1 = ‘1’;
char JobNumber2 = ‘2’;
char JobNumber3 = ‘3’;
char JobNumber4 = ‘4’;
char JobNumber5 = ‘5’;
char customKey;
byte Data_count = 0;
int x;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{‘1’, ‘4’, ‘7’, ‘*’},
{‘2’, ‘5’, ‘8’, ‘0’},
{‘3’, ‘6’, ‘9’, ‘#’},
{‘A’, ‘B’, ‘C’, ‘D’}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
DFRobot_RGBLCD lcd(16, 2);
void setup(){
lcd.init();
}
void loop(){
lcd.setCursor(0,0);
lcd.print(“ENTER MACH NO.”);
customKey = customKeypad.getKey();
for(byte i = 0; i < MachineNumber; i++) {
if(customKey == Machine*){*
-
lcd.setCursor(0,1);*
-
lcd.print(customKey);*
-
delay (1000);*
-
lcd.clear();*
-
lcd.print(“Machine Number”);*
-
lcd.print(customKey);*
-
delay(1000);*
-
lcd.clear();*
-
lcd.print(“Enter Job No.”);*
-
lcd.setCursor(0,1);*
-
customKey = customKeypad.waitForKey();*
-
if(customKey == JobNumber1){*
-
lcd.print(“DYE LOT SEL.”);*
-
delay(1000);*
-
lcd.clear();*
-
lcd.print(“ENTER TIME”);*
-
customKey = customKeypad.waitForKey();*
-
if(customKey){*
-
Minutes[Data_count] = customKey;*
-
lcd.setCursor(Data_count,1);*
-
lcd.print(Minutes[Data_count]);*
-
Data_count++;*
-
}*
-
}*
-
}*
-
}*
}