I'm quite new to Arduino so please bear with any of my faux-pas'
Im trying to create an automated brewery controller. I've followed the steps for displaying text on an LCD using the LiquidCrystal Libraries and the code compiles correctly.
The only problem I have at the moment is being able to move through on screen menus.
I have a 4 button keypad, and four selections on screen.
What I would like for the program to do is, for example
When button 1 is pressed, a different menu comes up on screen
When button 2 is pressed, another menu different to that comes up.
For example
#include <Keypad.h>
#include <LiquidCrystal.h>
const byte rows = 1;
const byte cols = 4;
char keys[rows][cols] = {
{'1','2','3','4'}
};
byte rowPins[rows] = {14};
byte colPins[cols] = {15, 16, 17, 18};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// put your setup code here, to run once:
lcd.begin (20, 4);
lcd.noCursor();
lcd.setCursor (18, 3);
lcd.print ("The Old Paper Mill");
lcd.setCursor (16, 2);
lcd.print ("Self Contained");
lcd.setCursor (17, 1);
lcd.print ("Brewing Unit Mk2");
lcd.setCursor (13, 0);
lcd.print ("Loading!");
delay(5000);
lcd.clear();
lcd.setCursor (18, 3);
lcd.print ("The Old Paper Mill");
lcd.setCursor (18, 2);
lcd.print ("Choose a Beer Type");
lcd.setCursor (19, 1);
lcd.print ("1:Pale || Dark:2");
lcd.setCursor (19, 0);
lcd.print ("3:Lager || Fruit:4");
This is what I have so far. I can handle the print, clear screen and setCursor stuff. I just need help with the code for recognising a key press and what to do when a certain key is pressed.
Eg:
if key=1
lcd.clear();
lcd.setCursor(wherever the cursor needs to start);
lcd.print("Whatever the menu contains");
if key=2
lcd.clear();
lcd.setCursor(wherever the cursor needs to start);
lcd.print("Whatever the menu contains");
And so on an so forth.
Can anyone suggest the code I need to use?
Regards
Justin