Multimotor Control

So I’m attempting to use Vexcode V5. I can either type the code out in C++ or the blocks. In either case I can not figure out how to have both intake motors spin at the same time in autonomous. Can anyone help me out?

What does your current code look like? Its easier to find the issue if you post your code

The laptop isn’t on wifi or id just curious c and v it in.

For the first spin intake, put a comma next to turns and write false.

rightIntake.spinFor(forward,100,turn,false);

I dont know if vexcode will allow you do this. This would be how vexcode pro does this.

Also, if If you are programming in text I would recommend using vexcode pro rather than just vexcode.

1 Like

Yeah. You need to place the false there for the “wait for completion property”
The entire code segment should read:

rightIntake.spinFor(forward,100,turns,false);
leftIntake.spinFor(forward,100,turns);

This essentially “queues up” both actions and executes them simultaneously. For the first command (rightIntake) we do not wait for completion so it goes onto the net line while the right intake has just started spinning. The left intake works as normal.

This functionality enables another type of advanced autonomous programming in which no drive commands wait for completion and you have a wait command between all (or most) sets of drive commands. My friend uses this to great effect on his robot. It enables several different drive commands to be executed at the same time, for instance, driving forward while spinning the intakes.
i.e. (This is formatted for VEXcode PRO)

rightIntakeMotor(fwd,100,rev,100,pct,false);
leftIntakeMotor(fwd,100,rev,100,pct,false);
wait(500,vex::timeUnits::msec);
drive(fwd,10,rev,50,pct);

This hypothetical code segment would spin both intake motors and drive forward at the same time. There is a 500 millisecond pause between the intakes starting to move and the drive starting to move.

2 Likes

Whats the difference?

did that answer your question?

I cant try until practice.

Seems to work. Thanks for the help.

1 Like