Switching functions with button

hello everybody;
so i have this robot for a class project . i want it to run using my phone as a normal RC car but when i push the button it makes it automated and avoids obstacles?
does anybody have an idea?

So where is this robot?

Welcome to the forum.

If you do not want to be ignored by the robot and the Arduino community, I would suggest you improve your communication skills. Your user name is longer than your post and you had time to upload a picture.

Please read

Posts that provide good information tend to get a lot of help in the forum. Have a look at a few posts with lots of replies.

How would it know when to stop acting like a robot and start acting like an RC car again?

-jim lee

i was thinking to use a puchboutton like this
#code
MODE = digitalRead(B);
if (MODE == HIGH){
M++;}
if (M%2==0)
fnc1 …
if (M%2==1)
fnc2…
#code