Motors don't stop at the same time?

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

Motors don't stop at the same time?

Postby brickinthecloud » Wed Nov 13, 2013 5:40 pm

I've got the following code and I find that both motors start at the same time, but one stops and then the other, thus my robot does not stop in a straight line, any thoughts?

Motor.B.forward();
Motor.C.forward();
Thread.sleep(2000);
Motor.B.stop();
Motor.C.stop();
brickinthecloud
New User
 
Posts: 21
Joined: Thu Nov 07, 2013 1:56 am

Re: Motors don't stop at the same time?

Postby gloomyandy » Wed Nov 13, 2013 6:48 pm

The first stop will block until the motor has decelerated and actually stopped. If you want to stop both at the same time you need to use the version of stop that allows you to specify that the method returns immediately.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3964
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Motors don't stop at the same time?

Postby esmetaman » Wed Nov 13, 2013 7:16 pm

Hi,

I had the same doubt, some time ago.
viewtopic.php?f=18&t=4698

Cheers
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://www.iloveneutrinos.com/
User avatar
esmetaman
Advanced Member
 
Posts: 290
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain

Re: Motors don't stop at the same time?

Postby brickinthecloud » Thu Nov 14, 2013 12:23 am

Excellent thanks that sorted it!
brickinthecloud
New User
 
Posts: 21
Joined: Thu Nov 07, 2013 1:56 am


Return to EV3 Software

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

more stuff