Menu system suggestions

I have a ultra sonic sensor based liquid lever project. I have the code setup for the sensor. The code uses variables in it calculations.
int Calibrate
int tankDiameter
int tankDepth
int tankDesign

All are pretty self explanatory except tankDesign. This is a number that corresponds to a formula that will calculate the liquid in different shaped tanks. The Level of liquid in a 36" diameter X 48" tall tank 50 gallons in it will be different if that same tank in horizontal. There are several others as well.

Anyway I am looking for a menu system that I can use upto 3 buttons to configure the system. This configuration will usually only take place on initial setup. The parameters should never change.

I am thinking hiding a pushbutton or a slide switch that will turn on program mode.

press one button to select the parameter
another button to increment the parameter
and another to decrement the parameter

Once settings are complete wait a length of time or turn off the slide switch to exit program mode.

The system uses a 2x16 lcd display
When it is not in program mode I would like to use one of the buttons to display the Liquid level.

I know I will need to write the selections to memory and reed them back on power up. But that's the next step.

Does anyone see any problems with a menu system like the one I describe. I have never done a menu before. And this one seems different than the examples I've found on the web. Most something is selected and run. But I want to select, change, save, and use as a variable. I also do not need the menu to be running all the time.

Any help getting started or pointers will be appreciated.


It is totally doable. An easy thing to do would be to check the state of one of your buttons at power-up [inside setup()] and if it is being pushed, call a programMode() function that does what you describe. If it is not pressed, you just skip it.

The next step would be to read the values in from EEPROM and start your main program. You can design your programMode() function to store the values in EEPROM so any changes will get incorporated when the values are read in.

There are one or two examples if you google of menus , plus I believe there might even be a library for one ??

When I did this , as the previous poster said , check for a button being pressed during setup , I then ran a separate procedure ( calibration) if this was pressed , which saved the revised factors to eeprom.
After returning to set up, At the end of setup I read the variables back from eeprom ( whether changed or not) .

In the calibration routine use a “while” loop that continues until your “save values “ button is pressed. In that while loop you can look at and act upon other button presses

Google the Arduino eeprom library too

This is why I ask for ideas. This makes things better.

check the state of one of your buttons at power-up [inside setup()] and if it is being pushed, call a programMode() function

I am checking out the eeprom library now.

Thanks guys