Hi.I'm a beginner with Arduino programming and need some advice. My project is a bit bigger, but I'm stuck right now on this (quite simple?) problem.What I need is read numbers that are typed on o 4x3 keypad, then store them in a variable and put on LCD display. The variables are three, and for each one the user can enter values. My code looks somtehing like this (the setup part is not shown):

This is only for the first value. What I need is when the user press #, the firstvalue is stored, and the program continues on the input of the second value. After the second value, it continues with the input of the last (third) value.

I've tried doing some functions and calling it after the # button press, but with no luck. Can someone please give me a hint, how should it look like?Thank you.

You need to keep track of whether the keypad input is for the first variable, the second variable, or the third variable. The easiest way to do this is to put the code you have in a function that returns an int.

Thank you.I've tried that code, but I must doing something wrong (dunno what). To me, it looks like the program never 'waits' for the # button to pass the stored number out of the called function.When I read the output in the function, it gives me only zero, whatever is pressed. And when the output is read in void loop, there is only a constatn flow of zeroes.What I need to do is count the numbers in one variable until # is pressed, then the program should continue the same way for the second variable etc. After that the code will work with the inserted numbers...