Adding a "Learn" and Save to my Project

Hello, I'm wondering if someone could help me.
I'm building a basic "cluecracker" game
However rather than plug in the USB every time I want to change the code (switch pattern) I'd want to have a button which puts it into a learn mode so I can set a new code,

Is this something I can do on an Ardiuno?

Hello and welcome.

Your question is too vague to provide a sensible answer.

While I could guess at what a 'cluecracker' game is I would expect that my guess would be different to what you have done, you need to tell us what you have done.

While it is certainly something some one could do on Arduino I don't think a single one of us, other than you, knows whether you could do it; we have not a clue what your abilities are.

Please read:
General guidance
And How to use this forum

For help on how to ask a question we can provide a helpful answer to.

Enjoy.

If "new code" means a new Arduino program then, NO. You have to upload a program from your PC.

If it means a secret code number then YES. You can store values in the Arduino's EEPROM memory which will be remembered when the Arduino is switched off.

...R