Using NXT Motor as Rotation Sensor

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

Moderators: 99jonathan, roger, imaqine

Using NXT Motor as Rotation Sensor

Postby traisen » Mon Jan 30, 2012 12:58 am

Hi,
Is there a Lejos class that uses NXT Motor as a rotation sensor? I havn't found one and as an exercise trying to add one.
NXT-G has it react based on angle test like > 45 degrees then returns true.

I am using an EncoderPort and setting motor power to 0 and coast.

But I am not sure about the listener part... especially how to know when the motor has started /stopped moving (because a user has turned it). Looks like it should be an interrupt, but not sure how to set this up.

Thanks for any hints
traisen
New User
 
Posts: 23
Joined: Mon Dec 15, 2008 6:53 am

Re: Using NXT Motor as Rotation Sensor

Postby traisen » Mon Jan 30, 2012 1:47 am

Just found ListenerCaller and using SensorPort as my example for callListeners.
The "rotation sensor" is on motor port so .. studying code.

Still curious if something is already there.
(And if I'm on the right track.) Thanks
traisen
New User
 
Posts: 23
Joined: Mon Dec 15, 2008 6:53 am


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

cron
more stuff