Last year, I was using Cortex and my instructor gave me some jumper clips so I could use them to choose autonomous easily. However, this year we switched to the V5 brain system. Is it possible to use jumper clips on the V5 system? If possible, could you show me how?
I mean how to use them within the code.
I would assume. Just get a digital input like any other triport sensor. If you want the specific code then please let us know what environment you are using (vc, vcs, pros, RobotMesh?)
There is also the option to have multiple programs on the V5 and select them via the screen or controller. You can also program the screen in your preauton to have a custom gui selector, or you could go with a different triport sensor like a potentiometer.
Going along that, the touch screen is easily programmable. Combined with the fact that the screen must be accessible and three wire ports are at a premium on V5, i would suggest making a program switch using the screen.
Jumper clips are the same as digital devices. You should configure it as a limit switch in your program. Doing so will return 1 when the jumper clip is plugged in and 0 when the jumper clip is unplugged.
I like your idea but does that mean I would make the same program but with a different autonomous so there are 2 and I can pick which one I want?
You can keep it all in the existing program. In order to select between the two autonomous routines you can use an if statement that checks the value of the jumper cable’s sensor port.
For example, in autonomous you would do:
if(jumper.get_value() == 1) runAuto1() else runAuto2()
If you use this sort of implementation, be mindful that you should plug/unplug the jumper to your desired selection before autonomous starts.
If you want to set up conditionals using the Brain screen - then you might want to look at this:
It builds off of James Pearman’s button code.
This helped a number of teams last season at worlds.
[edit - my teams used this code and did note there were flaws in using event registration in the example… it is meant as an example approach not as a complete solution. ]
[2nd edit - please please credit James Pearman for the foundation of doing Brain screen configuration - I was taken aback by teams who did not acknowledge his contributions in this area…]
Others have already commented on this, but you can go both ways. Last year, our bot had three different programs, one for red, blue, and skills. We programmed the screen and vision sensor LED to indicate which run was active. This way can cause complications as to what code have which features or function revisions though. If we fixed something in one program, we had to copy and download the changes to the other two.
I think this year we will be looking to make a single program with an autonomous selector switch.
The example I posted with 8 buttons allows one program to have 256 combinations of features in one program, so no worries about downloading the wrong program.