Hello. We are having trouble with our sensing of a bumper switch. We are trying to make it where the robot will not move/go onto the next task until the ball is in the puncher. We will greatly appreciate any help.
I would try using a limit switch.
that is what we are using. Sorry I meant that
V5 or Cortex, and what coder are you using?
v5 and C++ iv Vex Coding Studio
Autonomous, correct? If so, I believe there is a function for waiting until bumper pressed or something similar to that. I would help more, but I don’t have V5.
what function do you use in Robot C
while (!switchname.pressing()) ;
will wait until the switch is pressed. No need to write a special function for it.
I tried to transfer that code you gave me and it didn’t work.
I have no idea how you used it from what you’ve told me, so I can’t offer any insight as to why it didn’t work. With troubleshooting, it always helps to provide more information about what you tried and how it failed than “it didn’t work”.
We are using C++. I used the "while (!switchname.pressing()) ; in my code. I put in the the name of our switch and put inside of void auto. It would complete the task (stop motor when pressing) but it wouldn’t wait. below is the code where I used the line.
RED SKILLS 3.0.vex (26.5 KB)
Right here?
void autonomous( void ) {
ADJUSTER.spin(directionType::fwd,10,velocityUnits::pct);
while( ANGLE_LIMIT.pressing());
ADJUSTER.stop(brakeType::hold);
If that’s where you used it, you left out the negation operator from my snippet: !
So it should have been while( !ANGLE_LIMIT.pressing()) ;
(In the future, pasting snippets tends to be easier than throwing a whole file at someone. The contents of autonomous would probably have sufficed here.)