This year for First Power Up we are trying to do multiple autonomous strategies and we have tested all of our code and it works. We have autonomous’s for going to the scale and the switch but we would like to be able to have a button on the driver station to be able to control whether we are going to the switch or the scale with a push button Boolean. We aren’t completely sure how to edit it so we can switch between the two using a button.
Probably the easiest way would be to use network tables. You could create a custom dashboard that includes an autonomous select button. Then, you could read that value in autonomous to select between the autonomous programs (see the auton select picture). This page has some useful information on using the dashboard program. I would suggest adding a boolean switch to the ‘custom’ tab of the dashboard, which then connects to a network table vi (see the dashboard picture).
Pi Fighter is right about using the dashboard, but there is a setup to put custom options in the auto selector control that is in the default build.
In Begin.VI there is a call to NT Write String Array that sets the values that will be available in the dashboard - and the default auto provides a read of the selected value and a case structure for the option. (see attached images for example)
Some time back (I think last year, but I can’t find the post) some code was posted to translate an Enum into the string array, and the string that the dashboard sent back back into the Enum (if that is desirable, PM me and I’ll work the code back out and repost it).
If you really want to use a button (should be a switch so that is is set and then hands off for auto). Check out https://frclabviewtutorials.com/sensors/dashboard/arduino/ for an example setup of using an Arduino to read the switch (potentiometer in the tutorial, but switch would just require a digital read instead of analog) and send it to the robot.