Running two motors at the same time

#1

My team 11029B from Lincoln middle school has been trying to do programming for a while but we’ve hit a roadblock. Our arm runs off two motors so we tried the move motor command but it moves motor 10, our right side arm motor, then it moves motor 4, our left side arm motor. Is there a way to make motors 10 and 4 run at once?

0 Likes

#2

What programming language are you using? ROBOTC?

0 Likes

#3

The rotateFor function lets you choose wether or not to wait for the motor to complete its rotations. Set it to false if you want to have multiple motors moving at the same time.
In this case I would write something like
motor10.rotateFor(rotations, vex::rotationUnits::rev, false);
motor4.rotateFor(rotations, vex::rotationUnits::rev, true);
Now it will run motor4 right after motor10 starts and will wait for motor4 to complete rotating.

33%20AM

0 Likes

#4

Similar problem earlier this year…this link may help.

0 Likes

#5

That looks like VCS code so isn’t applicable to IQ. For IQ, it will most likely be ROBOTC, Modkit or RMS.

0 Likes

#6

We hit this snag earlier this season. If you are using graphical RobotC you have to first go to Window then Menu Level and set it to either Expert or Super User. That will then reveal some new choices. The one you want is SetMultipleMotors under Motor Commands

0 Likes

#7

Yes, the language we use is Robotc.

0 Likes

#8

As @ChrisR246 says, you can use the setMultipleMotors command to turn on numerous motors at the same time. However, this command only allows you to set speed and not a specific movement distance. For that, you can use the setMotorTarget command. This allows you to set the target position for a single motor but the command is not blocking, meaning that you just need to put the two commands one after the other and they will appear to happen at the same time. Just remember that because they are non-blocking, the next command directly after will also happen unless you have some kind of waituntil command as well.

0 Likes

#9

So to combine answers given by @kmmohn, @ChrisR246 and @calvc01, you can use time or sensor input from motor (setMotorTarget is using the motor’s encoder as a sensor), distance sensor, bump sensor, color sensor, or gyro. How to test the sensor, both blocking, and non-blocking, to stop (or change speed) is learnable. Read different examples, try lots of different ways. Remember to reset “zero” for you sensor/timer where applicable, or do “math”…

0 Likes