Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




membrane keyboard m...
 
Share:
Notifications
Clear all

membrane keyboard menu


(@beargritter)
New Member
Joined: 4 months ago
Posts: 1
Topic starter  

Hi Guys and Ladies,

53 yr old newbie here after a few pointers

First a little background...

I've converted a fridge into a fermentation chamber for brewing my beer.

The temp is controlled by an arduino taking readings from a temp sensor and then heating/cooling as required.

 

So far so good.

 

I now want to add a membrane keyboard to give me the option of cooling or fermentation and then if fermentation is selected set the temp required.

 

Therefore, I require a menu

 

The samples I've seen on the interweb are either for lcd/button or lcd /pad/password.

 

Am I correct in thinking I just need to kick my brain cells into gear and alter code for buttons to keypad?

 

I've already sussed getting the keypad to work, but for some reason menus confuse me.

 

A little help please pointing me in the right direction.

 

Many thanks in advance


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 2005
 

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.


ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: