Programming issues related to a motor moving a certain amount at the push of a button

I’m attempting to have my robot move its claw whenever the button X or A gets pressed, but my current dilemma is that whenever it can’t follow out the action, the program just stops working entirely. I do not know how to solve a remedy to this issue, so I request support.
jlkfdsfjioadsfoadkf

Wait, if it’s a clawbot, I’m pretty sure there is a built in program on the brain.

You can add a false at the end for the rotateFor and add a wait time for how long you want it to run for

So what to do:
Add a false at the end of each rotateFor
Add a wait the line after rotateFor (maybe like 1 or 2 seconds?)

2 Likes

I added a sleep command because I didn’t know what else to add, but the false command appears to say it’s unused, so this isn’t even working.

Post a picture of the new code. The false at the end will make rotateFor non-blocking

1 Like

The false is also highlighted in green, which indicates that it won’t have an effect. I also moved changed the button locations by the request of a teammate too.
jksdlk

The , false needs to still be in between the parenthesis

1 Like

When I tried that earlier it gave me an error, sorry. The issue currently is that it now just moves at a slow pace. It also doesn’t go on the set path that I defined. By the way, AvrgSpeedPCT refers to 100

Claw.rotateFor(.636, vex::rotationUnits::rev, AvrgSpeedPCT, vex:: velocityUnits::pct, false);

Try using this and the sleep will need to be as long as the claw takes to move. This should move it for .636 revs at full speed (assuming AvrgSpeedPCT is 100) and it is non-blocking

2 Likes