User Interface of Vending Machine.

Good day! I'm having a proble
with my program on the part of user interface.
It asks the user to select component to dispense using the keypad of vending machine.
Then the serial monitor will ask the user "continue transaction?" We set a button for Yes or No on the keypad.
But still the selection of component is still active which lets the user to select other component. We want to disable the selection of component after the user choose.

In the serial monitor it appears like this

Select component: (choices are numbers 1-9 on keypad)

After selecting a number though, the user can still select other numbers which shouldn't be valid. We also intend to add a "Continue?" function after selecting a number. Pressing "A" means yes, "B" for no. But this doesn't work.

We want to disable the selection of component after the user choose.

You are going about this wrong.

Machine: What would you like?
User: I want some string cheese.

Machine: How many?
User: I want some Pepsi?

Machine: Hey, stupid. That's not what I asked. I said how many?

See? You don't disable the selection of a different product. You simply ignore any attempts to do so.

Of course, you really need to allow for a user to change his/her mind or correct making the wrong selection.

But this doesn't work.

On the other hand, the code you posted works perfectly. There was absolutely nothing wrong with the code you did post.

Got it. Anyway, thanks. Maybe we'll just set the coin acceptor as the confirmation of the purchase.