Control motors exact same time.

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

Moderators: roger, imaqine, 99jonathan

ruarda
New User
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm

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.

User avatar
gloomyandy
leJOS Team Member
Posts: 4736
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

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);

ruarda
New User
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm

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.

User avatar
gloomyandy
leJOS Team Member
Posts: 4736
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

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?

ruarda
New User
Posts: 3
Joined: Thu Feb 23, 2012 3:10 pm

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!


Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 1 guest

cron