Help a BEGINNER with making a motor move left and right

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

Moderators: 99jonathan, roger, imaqine

Help a BEGINNER with making a motor move left and right

Postby janvos2506 » Mon Oct 24, 2011 9:02 pm

Hey!

So i am starting this thing and made a sentry gun(ever played black ops?)
Well i want my motor motor.A to move left and right.
From 0 degrees to 63 degrees.
Now i can't get this to work :(
Or is there a way to make it move until it gets stuck and then reverse?


Thanks
janvos2506
Novice
 
Posts: 34
Joined: Mon Oct 24, 2011 8:58 pm

Re: Help a BEGINNER with making a motor move left and right

Postby fieranmason » Mon Oct 24, 2011 9:10 pm

using PCcomms over bluetooth

Motor.A.rotate( 90, true );

if you want control to return immediately to your program

Of course you'll need to deal with the fact that initially the motor classes are missing a necessary event listener but you can dig that out of the forums. There's a thread about it.

If you're doing stuff on the NXT as opposed to controlling the NXT from the PC I can't help you as I have no experience with that.

Fieran
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Help a BEGINNER with making a motor move left and right

Postby janvos2506 » Mon Oct 24, 2011 10:14 pm

where do you get the idea of controlling it with a pc?
:p but thanks will look over it
janvos2506
Novice
 
Posts: 34
Joined: Mon Oct 24, 2011 8:58 pm

Re: Help a BEGINNER with making a motor move left and right

Postby Rickz2020 » Wed Oct 26, 2011 11:48 pm

Which motors are you using? Are you using the servo motors? These - http://www.1000steine.com/brickset/images/9842-1.jpg

If so, I believe you can use the rotateTo() method. Check it out in the API: http://lejos.sourceforge.net/nxt/nxj/api/index.html

Regards,

Rich.
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.


Return to NXJ Software

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 3 guests

more stuff