How do I assign the potentiometer as a button? What should I write in the code?

Hello to everyone . i made a handmade handbrake for my simulation but forzo horizon 4 wants its handbrake as a button. How do I turn a potentiometer into a button?

Thanks in advance for your help

analogRead and a fixed threshold?

Pick a midpoint value on the A/D conversion such as 512. Then if greater then 512 button is pressed, if less then 511 button is open. You can add hstersus if you want.