so I am trying to make a code that will start in task main but when the bumper is pressed it will go to another task then if the bumper is pressed again it will go back to task main. if anyone can help me that would be appreciated.
What program are you using?
sorry, i am using robotc
So for this you will want to use a function not a task, here is a website the explains them great.
Just make an if statement in the while loop in task main for if the button is pressed that calls the function and another if statement inside a while loop in the function that breaks the function once the button is pressed again. You will also want to put a waitUntil statement before calling the function to make make sure the bottom is released first. Same before breaking the function
This other topic sounds very similar to what you are trying to do. This type of program works best using state machines. See code example in there:
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.