VEXCode V5 Blocks Question

So this what help says for this block:17 PM
59 PM
In the example, it has a “stop driving” block. Will the drive stopping still be “hold” even if I don’t but the stop driving block in? Is the stop driving block needed anyway?

set drive stopping doesn’t stop the bot, that’s what ‘stop driving’ does.
‘set drive stopping’ more or less tells the motors how to stop, which is remembered when the code tells the drivetrain to stop.

1 Like

What does it do then if I don’t put the “stop driving” block?

the brake type is set but the motor isn’t ever told to brake, so it keeps driving (unless the program ends)

1 Like

I forget what the default setting is, but for clarity I would include it.

In this example, yes. Typically, no.

Normally you would use a different block to tell it to go forward a certain number of rotations. However, the behavior of your drivetrain after it is stopped will still be affected by this setting anytime the bot stops moving. Normally I advise my students to set all of these settings right after the “when started” block, and then you only have to use it again if you change it.

3 Likes

58 PM
if I’m understanding correctly, the code here won’t stop the armMotor2?

yep. this will not stop arm motor 2 it will only spin arm motor 2 when r1 is pressed.

2 Likes

But would it Hold when not pressed, Brake when not pressed?

Because you’re just using spin forward, the motor just won’t stop. If you tell it to spin for .5 rotations, then the moror will hold after it completes the movement.

1 Like

03 PM
Would something like this work then? I just want the arm to lift when R1 is pressed, and when it’s not, hold it’s position.

That would not work because on the first r1 press the loop is executed infinitely. You want the forever loop outside the if and an else statement telling the motors to hold when the button is not being pressed.

1 Like

Ok the thing is, I want armMotor1 and armMotor2 to move at the same time(because they’re the motors for the arm). But, when I setup the controller, there was not this option. So now I’m wondering, when you set up the code, what code does it put in? I want to know this because I want to copy the code and put it in for armMotor2, so that the arms turn at the same speed, etc.
Or can I do this just by adding a “if armMotor is spinning, spin armMotor2” block?

image

3 Likes

is that basically the code it auto generates when you setup the controller?
Would this work as well, or would it slow it down?
17 PM

I’m not exactly sure what it looks in the back end when you use that set up.

The stopping setting you can just put under your when started block, you don’t need to rerun that part every time you push the button. Your code will look a lot cleaner that way.

2 Likes