Wait until ball is sinced

#1

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.

0 Likes

#2

I would try using a limit switch.

0 Likes

#3

that is what we are using. Sorry I meant that

0 Likes

#4

V5 or Cortex, and what coder are you using?

0 Likes

#5

v5 and C++ iv Vex Coding Studio

0 Likes

#6

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.

0 Likes

#7

what function do you use in Robot C

0 Likes

#8

while (!switchname.pressing()) ; will wait until the switch is pressed. No need to write a special function for it.

0 Likes

#9

I tried to transfer that code you gave me and it didn’t work.

0 Likes

#10

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”.

1 Like

#11

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)

0 Likes

#12

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.)

1 Like