Help with keypad(2)

Good day to all !
I have been wondering on this for quite some time , and that is how do i use the switch case function to store myValue currently and use " * " to tell arduino that i want to enter this current value? for example if i am at 12 now and i want to store 12 as my current value , how do i do that?

fyp2.ino (1.09 KB)

If you need to store the current value before entering another one then save the myKey variable in an array and increment the array index variable. Set myKey to zero, display it and get the next number.

You will either need to input a fixed number of entries or have an "I am finished" key, perhaps '#'

The values saved can be read from the array later to be used in the program.

Easy.

loop() {
  if (key != NO_KEY) {
    switch (key) {
      case '*':
        // Store value in array, reset myValue, increment counter, check that counter is not out of range.
        break;
      case '#':
        // Illegal character. Not allowed to use this, ever. Send user to jail.
        break;
      default: 
        // It's a digit, no other options left. Deal with it.
    }
  }
}