NXTMMX- Error in class?

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

Moderators: 99jonathan, roger, imaqine

NXTMMX- Error in class?

Postby fraserpricee » Mon Jan 06, 2014 7:13 pm

So I'm using the NXTMMX, and getting an error.
When I start/stop a motor for the first time, it's fine. However, if I then try to start it again (after it has stopped), it will not start, or just twitches and then does nothing. Motors connected directly to the NXT Brick are fine. Here is my code:

Code: Select all
import lejos.nxt.SensorPort;
import lejos.nxt.addon.MMXMotor;
import lejos.nxt.addon.NXTMMX;

public class Test {
   public static SensorPort S1 = SensorPort.S1;
   public static NXTMMX frontBack = new NXTMMX(S1);
   public static MMXMotor frontMotor = new MMXMotor(frontBack, NXTMMX.MMX_MOTOR_2);
   public static MMXMotor backMotor = new MMXMotor(frontBack, NXTMMX.MMX_MOTOR_1);
   
   public static void main (String[] args) throws InterruptedException {
      frontMotor.setPower(100);
      frontMotor.forward();
      frontMotor.stop();
      //ERROR OCCURS HERE- WILL NOT RESPOND AFTER THIS POINT.
      frontMotor.setPower(100);
      frontMotor.forward();
      frontMotor.stop();
   }
}


Thanks in advance for any help.
fraserpricee
New User
 
Posts: 2
Joined: Fri Nov 01, 2013 6:32 pm

Re: NXTMMX- Error in class?

Postby kirkpthompson » Wed Jan 08, 2014 3:01 pm

Hi.

It looks like you are using an old version of the classes. With the newest version, you should use the getBasicMotor(), etc. method of NXTMMX to get the motor instance. What version of LeJOS are you using?

-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff