How to program two NXT motors to run at the same time?

I'm working on a project with multiple axis of movement… trying to get two motors to run at the same time in order to achieve a mix of two!

• Can you describe the result you're trying to achieve? I don't understand the "mix of two" part. Nov 22, 2013 at 2:41
• I'm building a robot that will draw specific lines on a popsicle stick. The stick is on a table that moves up and down. The pen is attached to something that makes it move left and right, forward and back. I can achieve a straight line… but for a diagonal line I have run into trouble. Nov 22, 2013 at 2:53

In NXT-G if you place a block after another block it will run in succession. To get two motors running at the same time you can place two motor blocks, one at the start and the other just above or below. Drag the sequence beam (the white Technic beam) to the second block to complete the circuit.

Don't forget to make sure the motor blocks are controlling separate ports and that both ports on the NXT brick are attached to motors.

You could just use one block to control the two ports but they would both have to be running in the same direction.

It depends on the programming language, but assuming you're using NXT-G then the Move block may be sufficient. The Move block is designed to coordinate 2 motors so that they both rotate at the same speed over a distance. The Move block has settings for speed/power of the motion. There is a forward/backward setting. There is also a steering setting, which is implemented as a slider bar giving about 20 ratios of motor output.

Setting speed to 75, forward and steering = 0 should give you a diagonal line.

Change the steering to something +- 100 to give other diagonal lines.

To give straight horizontal or vertical lines, turn one motor off, the other on.

• Both answers helped, thanks! It was just a little thing I had to change in the command… now to get the exact angle of diagonal I want is a whole other story :P Nov 23, 2013 at 2:50

If you want two things to run at the same time place the first just in front of but not touching the start block and the other just below the first. Click on the joiners (grey ovals on the end where blocks join) and press wire from here and tap on the first code. Do the same with the second.

do 2 starts. From the orange. :)

• Hi krisblom! I believe you have the correct answer, but it would be much nicer if you could flesh it out a bit better. E.g. by including detailed steps, maybe screenshots, etc. Apr 12, 2016 at 17:37