Bumper Switch Issues

Is there a way for a bumper switch to be used in driver control for wheels? If there is please tell me how to by including an example program.

Like drive until you hit something?

Yes i am wondering if there is something that it can be used in driver control to cit the wheel motors.

im sure someone has the code for it but one thing you could do is write the auton function you want it to do in driver than when you hit a button it just runs that function.

Unless you want to move things while doing the function, than you could just have it so when you click the button it changes a variable and when the variable is equal to that value than it takes chassis control away from the sticks and drives until it hits something, but keep it all in if statements and when the bumper == 1 set the variable back to the original value to put control back onto the sticks.

I have already tried that, can you please send me a sample program.

Instead of asking for a sample program, think about the logic of the code you need.

Assuming you use RobotC:
You can use a


loop to run a certain block of code until a certain condition becomes false.
You use


to check whether the bumper switch is pressed (1) or released (0).
You can run a certain block of code until the bumper switch is pressed with


Now, just program the


loop to run motors. Don’t forget to stop them outside of the



while(button isn’t pressed){
Go Forward
Stop motors

Think of something like this :slight_smile:

Reminds me of how to build a hugger robot.

Listen to what @CATaclysm Delta_II said, programming isn’t THAT hard.