My 9 years old son built a printer/plotter. It uses motor B to move a pen horizontally and motor A to move the paper vertically. I was trying to code a method which would draw a tilted line by utilizing two motors. Two draw a line at particular angle one of the motors has to move at slower speed. Here is a sample code:
Motor.A.setSpeed(1000);
Motor.B.setSpeed(500);
Motor.A.forward();
Motor.B.forward();
Delay.msDelay(1000);
Motor.A.stop(true);
Motor.B.stop();
The problem is that the vertical motor A stops sooner then motor B and the line looks like a hockey stick.
\
\
\
\__
Stopping motor B first makes no difference.
Looks like motor A gets stalled at the end. But why? Anybody can explain that?
If I use unregulated motors and set different powers to them the line is straight.
NXTMotor motorA = new NXTMotor(MotorPort.A);
NXTMotor motorB = new NXTMotor(MotorPort.B);
mMotorA.setPower(100);
motorB.setPower(50);
motorA.forward();
motorB.forward();
Delay.msDelay(1000);
motorA.stop(true);
motorB.stop();
Thank you!
Alexander.
Problem running two motors with different speeds
Moderators: imaqine, 99jonathan, roger
- gloomyandy
- leJOS Team Member
- Posts: 6016
- Joined: Fri Sep 28, 2007 2:06 pm
- Location: UK
Re: Problem running two motors with different speeds
You are probably asking motor A to run too fast. Typically NXT motors will not run faster than 900 degrees per second you are asking for 1000. Try making both motors slower, say 600 and 300, if that works speed them both up etc.
Re: Problem running two motors with different speeds
Good idea! I will try it tonight!
Re: Problem running two motors with different speeds
I figured out that speed 500 or less works the best. Thank you!
Who is online
Users browsing this forum: Baidu [Spider] and 1 guest