go_away

Author Topic: LEGO help - How to control NXT motor!  (Read 925 times)

0 Members and 1 Guest are viewing this topic.

Offline raven123crowTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
LEGO help - How to control NXT motor!
« on: November 02, 2011, 06:29:14 PM »
I am working on a project to have my lego NXT navigate through block obstacles using the NXT sonar. I have modified my NXT, I have a motor mounted to left side of my NXT and the sonar is mounted on the motor. Now the problem is how to control my motor so that my sonar is always in the forward position relative to my NXT.

My NXT moves the motor for my sensor to detect the block obstacles and moves towards it, when my NXT is at a certain distance away from the block it avoids the obstacle but for some reason I cannot get my motor to return to the center or original position I have looked through the robotC IDE on how to control the motor but I donít fully understand how those functions work.

My point is any time my motor moves to detect an obstacle I want to return it to the original position.  Also I want the motor to rotate from (-180 to 180) degrees.  Please if you know an algorithm that will help me accomplish this task I will be most grateful. Thank You!

Offline RobotMan_24

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: LEGO help - How to control NXT motor!
« Reply #1 on: September 17, 2012, 01:06:13 AM »
Hey,

Are you programming it in the Lego Mindstorms GUI?  I've played around with it a little bit - I would think you could just use the "degrees" pull down menu selection on the motor properties.

I  have more experience sending direct commands to the NXT with motors and sensors connected to it/  I feel its a better way since you can use any programming language to control you NXT.  I would highly recommend looking at this tutorial:
http://www.robotappstore.com/Knowledge-Base/Programming-LEGO-NXT-Mindstorms/92.html
It goes over sending direct commands to the NXT - which will control your motor.  The commands can be sent over USB or bluetooth.

Hope this helps!
Robotman

 


Get Your Ad Here