multi purpose bot code

i am making a robot which can perform multiple tasks on commanding i m using arduino mega and connecting to my android phone via Bluetooth i want it to function like if i send a value it becomes a line follower, other case RC car, on another value, obstacle avoiding bot, and as such but i have problem with the code that how to keep the robot to once receive the type of function it has to as if RC car then further receive the vales to move accordingly and then again receive the values like now to become a obstacle avoidance robot and as such…PLZZZZ help…THANKS

To me the most critical part is : "arduino mega and connecting to my android phone via Bluetooth". This will allow you to test each bit of additional code you write.

What parts do you have working, now?


As you have not posted your program it is difficult to give advice.

The usual way is to have a variable that records the selected operating state and which is updated by a message from the control unit.