How to make the program stop

Ok I imagine this is a stupid question but how do I get a program to stop (using Vexcode V5 blocks)? Once all of the blocks in the program have run, the program just keeps going. How do I make it stop?

1 Like

If you want to exit whatever program you are running you can hold the power but on the controller for a couple seconds and it will stop running the program. As far as code wise you can tell the motors to coast at the end of your program and that should emulate exiting the program. I do not know of a way through code to automatically exit the program when finished though there might be one.

2 Likes

Thanks for the answer, but it doesn’t really help. The competition that we are doing requires that the robot stop the program after it is done, but we are not allowed to have contact with it at all during the period where the program is running.

1 Like

I am assuming that you have your program in a loop? Many driver control programs are put in a loop so that it continues to run (repeat) the program for the whole match. In Autonomous code you (usually) don’t want the program to loop so I would check if you have a Forever or Repeat in your Auton. code.

Edit: I don’t use blocks very often - looks like Forever and Repeat are the tabs used to signify (while in c++)

You will want to remove the blocks that cause your program to loop. Then it will run the procedures once and stop.

I don’t think it is possible to stop the program via the code. There might be a roundabout way to cut power to the bot, effectively stopping the code, but it wouldn’t be good to use this strategy a lot. What competition are you competing for that requires this?

Using blocks there is no way to achieve this. With text there is, but it’s currently not exposed to the end user.

6 Likes