Bumper switches

Hello
I was wondering how to use bumper switches in order to activate multiple autonomous programs. I use easyC. Example programs appreciated :slight_smile:

Nick

in the autonomous section, click variables

it will open up this chart
make a variable, an interger of value 0, and name it (anything you want)
for the example we will all it “red”

Then click and drag in a block called “get bumper switch”
click the “get bumper switch” block and place it in a while loop in autonomous section.
assign the bumper switch to variable “red”

then in the while loop put an if statement, name it “if red==1”

then put your autonomous code in the if statement

for more routines, simply make another variable, put another “get bumper switch” block(and assign it to the new variable), and another if statement with the next variable agreement for example “if blue==1”

I am doing this off the top of my head, i dont have access to easyC right now but its simple enough for me to be sure this will work.

Wouldn’t this code only work if you hold the bumper switches down ? I thought he meant more of a toggle but I may be wrong.

It will still work, because the code doesnt know what to do when red==0, thus will continue to execute red==1

This question has been asked many times, use the search feature.

One solution.

https://vexforum.com/showpost.php?p=354639&postcount=6

I use four limiters with ruber bands on the one I want and it works fine.:stuck_out_tongue:
No need for those LCD things.