entering 4 values as a PIN login

I have been given an assignment to allow users to input 4 digits (for smartphone PIN let us assume) in a 4-digit display 'Open Smart Rich Shield'.

KEY1 button is used to choose/input a random value (from 0 to 9). If I arrange values from 0 to 9, using map function does not help me press button INPUT to transition from one number to another in the same digit value:

    case firstCode: /this is the first stage (inputting 1st digit in a screen)

      if (buttonPressInput) //if this button (inputting a value) pressed, 
        buttonPressInput = false;
        Display.show(digit1 += 1); //here I try to press input button to choose a value by increasing it
      }                                        //i tried to use map function but pressing a button cannot let me move from number 1 to 2, 3, 4, et cetera...

      else if (buttonPressConfirm)  //if this button is pressed it will go to the next digit value
        buttonPressConfirm = false;
        displayState = secondCode;
      } break;

KEY 2 button is used to store digit values and transition from one digit to another.

I want to understand when a button is pressed to choose 1st digit value, i press the other button to store that value and transition to digit value 2, but I want to keep each and every digit in 4-digit screen while choosing other digit values, in other words, when i choose digit value 1 and transition to value 2, I want value 1 to remain in screen while I am choosing a value2, same goes with choosing value3, I want value1 and 2 to remain there while I choose value3 and 4).

Can someone help?


We strongly encourage people to do their own work, and try various approaches.

However, if you have difficulties with a specific error, or have problems with coding a specific feature, post the details as described in the "How to use this forum" post.

Forum members will be glad to help.

Thank you for your reply @Jremington, where can I find that post though?

At the top of any specific forum topic.

@Jremington, could you be more descriptive please? You told me to post details of my issue in "how to use this forum" post, but all I am seeing is a topic that guides me to acqauint myself with forums and its rules when asking questions? Am I missing something here? I hope not, but let me know please

All the best,

How to use this forum -- please read

Don't overlook the very first line of that post, linked as READ THIS.