Info about menu

Hi guys :slight_smile:
I've a problem that keeps me still ... I have to make a mini-menu on a 16x2 display and i don't know how to do ..
The menu has to work like this:

QUESTION 1 ( forced choice between 4 fixed values ​​set by me)
1 ) first option
2 ) second option
3 ) third option
4 ) Fourth option

QUESTION 2 ( free choice )

  • User must choose an integer value from 1 to 100

I thought I'd make it all work with only two buttons:
For the FIRST question you would use a button to select one of four options and the second button to confirm.
For the SECOND question I thought that by clicking on the first button there was an int value in the display that increases starting from 1 to 100 and 100 to come back to 0, by pressing the second button would confirm.
Could you help me?

thanks,
Alessandro

Could you help me?

With what? Reading the state of a switch? Determining if that state has changed? Incrementing a value? Decrementing a value?

no, doing the menu :slight_smile:
I don't know how to start...i need help writing the code..

I don't know how to start

What do you think a menu is? It is a list of choices. Create a function. Call it displayMainMenu(). Make it show the choices on the LCD.

At the appropriate point in your code, call the function. You will then enter a state, waitingForMainMenuSelection.

The only events of interest in that state are the switch states (specifically, the changes to the states). When the "use this option" switch becomes pressed, the value of option at that time is interesting.

When the other switch is pressed, the value of option is incremented. The option variable obviously starts at 0 and is global.

This sounds like a school assignment. We don't write code for people here. We help people learn, direct them, and help find problems with their code.

First, break the problem down into small parts them solve each part.

Your first step is:

  1. How do I use Serial.print() to debug code so I can see what is happening?
  2. How to I check if a button has been pressed?
  3. How do I increase that so I can check if either of the two buttons have been pressed?

Get all that working and post the code, then we'll start talking about LCD screens and adding menus.

This will help you with the first two steps: