icomand Motor getSpeed

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

Moderators: roger, imaqine, 99jonathan

socrates
New User
Posts: 12
Joined: Sun Oct 28, 2007 7:36 pm

icomand Motor getSpeed

Postby socrates » Sat Nov 10, 2007 6:19 pm

Hi,

When I do

int speed = Motor.B.getSpeed();

I always get the value 720, even if the motor isn't moving.

Is this method working, or am I doing something wrong?

Regards,
Rupert

lawrie
leJOS Team Member
Posts: 953
Joined: Mon Feb 05, 2007 1:27 pm

Postby lawrie » Mon Nov 12, 2007 11:21 pm

getSpeed returns the current speed value set by setSpeed or the default speed setting. It does not return the current speed of the motor. Try getActualSpeed().

socrates
New User
Posts: 12
Joined: Sun Oct 28, 2007 7:36 pm

Postby socrates » Thu Nov 15, 2007 9:34 am

There isn't a getActualSpeed() method in the icommand API, as far as I can see.

Regards,
Rupert

lawrie
leJOS Team Member
Posts: 953
Joined: Mon Feb 05, 2007 1:27 pm

Postby lawrie » Fri Nov 16, 2007 8:54 pm

I didn't realise you were using iCommand.

The leJOS NXJ Motor class has a getActualSpeed() method.


Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 2 guests