I have an arduino uno that connected to a 16x2 LCD and 4x4Keypad.
I am trying to make a initiation menu that will get the program parameters and will run only in the "setup()" section.
In the start of the program (setup() section) the user will get a opening screen such as this:
"Press A to start"
"the program init"
and after the user will press A, he will get a set of few screens to set the program parameters.
example:
"1.Time Sync:"
" Hr:Min:Sec "
"2. Date Sync"
"dd/mm/yyyy"
"3.Tank Capacity"
"Capacity:"
My problem is that i need that the user will enter the parameter and will press A
(example: the tank capacity is 5L, so when the LCD display:
"3.Tank Capacity"
"Capacity:"
the user should press 5 and then A)
All of your code is in setup. You call keypad.getKey() to get a key. Unless you are holding down a key when the Arduino starts, keypad.getKey() is going to return NO_KEY.
You have a while loop that does something while key is NOT NO_KEY. But, key IS NO_KEY, so the body of the while loop is skipped, ending setup().
You have no code in loop(), so nothing happens.
That being the behavior you are seeing, I would say that there is nothing wrong with the code you have written.
The problem is that you haven't written the code to do what it is you want it to do, and haven't clearly (at least so I can understand it) defined what it is you want to do.
I think you need to either work on the requirements, or learn how to do it on your own.
thanks for the replay PaulS,
of course this only a small part of a big program.
in this part my requirements is to display on the LCD 10screens (screen = 2row in the LCD),
in each screen the program will ask from the user to enter (by the 4x4 KEYPAD) a parameter that will be display on the LCD,
after the user enter the parameter and press 'A' on the keypad the program moves the the next screen and so on..
until the program reach the last screen and then, the program moves to the loop part and uses the parameter that the user entered.