icomand Motor getSpeed

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

Moderators: 99jonathan, roger, imaqine

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
socrates
New User
 
Posts: 12
Joined: Sun Oct 28, 2007 7:36 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().
lawrie
leJOS Team Member
 
Posts: 840
Joined: Mon Feb 05, 2007 1:27 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
socrates
New User
 
Posts: 12
Joined: Sun Oct 28, 2007 7:36 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.
lawrie
leJOS Team Member
 
Posts: 840
Joined: Mon Feb 05, 2007 1:27 pm


Return to NXJ Software

Who is online

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

more stuff