Control motors exact same time.

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

Moderators: 99jonathan, roger, imaqine

Control motors exact same time.

Postby ruarda » Thu Feb 23, 2012 3:21 pm

Hi,

Ive been trying to control two motors at the exact same time (stopping etc).
Normally when Motor.A.stop() followed by Motor.C.stop() is used there is a slight delay and the same using forward() method.

shown below.
Code: Select all
Motor.A.stop();
Motor.C.stop();


I found on the forums if you write it like this.
Code: Select all
Motor.A.stop()true;
       Motor.C.stop();


it will stop at the same time. Here's the link http://lejos.sourceforge.net/forum/viewtopic.php?f=7&t=3033&p=15001&hilit=+motor+stop#p15001

I tried this method and all i get is errors in the compiler. is there any other methods to achieve this?

Thanks for the help.
ruarda
New User
 
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm

Re: Control motors exact same time.

Postby gloomyandy » Thu Feb 23, 2012 4:02 pm

try moving the true inside of the brackets... Motor.A.stop(true);
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3964
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Control motors exact same time.

Postby ruarda » Thu Feb 23, 2012 6:16 pm

Thanks for the reply.

Sadly that also caused a compile error. Any other ideas ?

thanks for the help.
ruarda
New User
 
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm

Re: Control motors exact same time.

Postby gloomyandy » Thu Feb 23, 2012 6:24 pm

Post your actual code and the error... The above should have worked fine... Also what version of leJOS are you running and is your code intended to run on the NXT or on a PC connected to an NXT?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3964
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Control motors exact same time.

Postby ruarda » Thu Feb 23, 2012 10:56 pm

My dear sir u are a genius!
i looked at the installed version of lejos and I was running 0.9.0 and updated to 0.9.1, reflashed my NXT and it seems to be working!!

Thank you very much!

must make sure to keep up to date with lejos!
ruarda
New User
 
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

more stuff