Back Button

I am currently coding an auton selection process with the V5 controller using VEX C++. It uses the arrow keys to choose side and color. Once done selecting, I want to be able to hit the A button, and have something saying ‘proceed?’ pop up on the controller screen. This is already done. Next, I want to be able to hit the A button again to continue, or the B button to go back and continue selecting. How would I go about making a button make the code go back to a certain spot earlier on in the program?

Rather than go back, easier would be to not leave the section of code you’re trying to go back to until you detect the confirmation press of the A button.

That is easy. What I need is for the B button to make it go back. What you described I already have working. Currently once ‘proceed?’ pops up, it will be in a limbo state until you press the A button again, with no option to go back.

Right. I was telling you not to do that. Right now you have pressing A once leave the section of code that checks for left and right. Don’t do that. Handle the user pressing A within the same section of code that handles left and right. Something like this pseudo code:

function to select autonomous:
        if right:
            increment option counter
            check for overflow, then clamp or wrap
        else if left:
            decrement option counter
            check for underflow, then clamp or wrap
        else if A:
            wait for not A
            display confirmation prompt
            wait for A or B
            if A, return option counter
        display option text
        wait for not right and not left

Why use the V5 Controller for autonomous configuration when you have the touch screen on the V5 Robot Brain?

You can take a look at our modified autonomous feature selector example code which is based off of James Pearman’s button code he posted a while back.

WalshBots Autonomous Selector