Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How can I let both motors of the NXT move at the same time with just one command?
Posted
Comments
lindam88 8-Mar-13 21:56pm    
no,no,no... you can't do that

One command is not possible. It just works with the following code:

Motor.A.forward();
Motor.B.forward();
Motor.A.turnTo(xy);
Motor.B.turnTo(xy);
Motor.A.stop();
Motor.B.stop();

xy = motordegrees
 
Share this answer
 
v2
In case somebody is as crazy as me and comes across this in 2019 or later:
The
Motor.A.rotate(xy)
command blocks the processor, so
Motor.B.rotate(xy)
means, the motor B does the rotation xy on top while A is already halted. (At least my system does this...)

My code, I hope i can help someone:
Motor.A.forward();
Motor.B.forward(); //Both motors start turning
Motor.A.rotate(xy); //Both Motors turn, until A has covered the whole distance (relative)
Motor.B.stop();
Motor.A.stop(); //Both Motors halt


If you want both Motors to travel different distances e.g. with different speed, I'm sorry, I can't help you, but try to do some tricky calculations...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900