How to use push button to input value

I just want to make a door unlock system using Morse code as input.