Hi Beargritter!
Brewing beer - OK you have my attention 😁 👍
Interesting challenge - which should be very do-able, but it will be a first for me as well.
I presume you've done something like this article for the membrane keyboard - all keyboards work in a similar fashion with a matrix to determine what key was pressed.
I assume you have some sorts of LCD display hooked up, either a simple 16x2 display (easiest) or a more complex LCD display.
For the menu I'd start with writing out the workflow you expect. Something like this:
Default display (the Arduino is not doing or controlling anything, just sitting there being idle
[1] Cooling
[2] Fermentation
-> [3] Idle (do nothing)
When Cooling is selected (press 1) the display should show the following and take the steps to start cooling, and then just wait for a new "command";
-> [1] Cooling
[2] Fermentation
[3] Idle (do nothing)
When fermentation is selected (press 2) the display should first as the temperature, and I would assume this should grab 2 numbers you will have to enter:
Fermentation Temperature (C)
>
I don't know if you work in Celsius or Fahrenheit, I'll just assume Celsius for now.
After the second number was pressed, all the actions should be executed to do the fermentation process, and in the background wait for the next menu selection.
[1] Cooling
-> [2] Fermentation (20 C)
[3] Idle (do nothing)
I would assume that with option 1 and 2, you have several steps you keep repeating in the background.
To Accommodate this, I'd use a global variable. I would define states so you do not work with hardcoded numbers in your code.
For example:
// predefine states (vs referencing them in your as hardcoded numbers)
#define action_idle 0
#define action_cooling 1
#define action_fermentation 2
#define action_enter_temperature 3
int active_action = 0;
This variable can be used to display the menu, for which I'd make a separate function.
Something like this (I have no idea what kind of display you're using):
void DisplayMenu() {
switch(active_action) {
case action_idle: {
// display idle menu
}
case action_cooling: {
// display cooling menu
}
case action_fermentation: {
// display fermentation menu
}
case action_enter_temperature: {
// display enter temperature menu
// and read 2 digits for temperature
}
}
}
(more about the switch statement here - since I do not know how experienced you are)
I'll stop here, to see if this is what you're thinking of 😊
Feel free to ask, I'd be happy to try to help where I can.