LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 

How to control NXT motor's rotation by using LabView NXT Direct Commands?


You will find it in the "Control Design & Simulation" or you can find it in the "starting window" under Examples. Open "Toolkits and Modules" and "PID Control". Or use the searchfunction, serach for "PID". Use (almost) any .vi and copy the subvi PID.

0 Kudos
Message 11 of 23

Hello again


Forgot about the rotationcount. It uses the built-in encodersignal and it makes 360 counts in one whole turn (one count = one degree).

0 Kudos
Message 12 of 23
Thanks. Unfortunately I cannot find Control Design & Simulation on my version of LabVIEW. I'm using the 7.1.1 student edition which is given gratis from NI, not the full version. However, I did manage to find a PD Control Sub VI in the Toolkit Examples\NXT Programs "B Follows C" and will see if it can work.
0 Kudos
Message 13 of 23
I've figured a better solution after studying the fantom sdk and posted at theother thread on same matter:
0 Kudos
Message 14 of 23

Thanks for pointing out the direction to wander on 😉

A small problem arrises when you change the direction of the motor:
my (see attachement) based on previous writer Get&Set output state... vi gives me the unwanted result that when you change the direction of the motor, it turns approx 2x the set amout of Tacholimit (in my example 360°).

So whenever in previous state it went approximately from 0->360°->720°->1080 and then you'd inverse direction it is going from 1080 -> a very unprecise 360° !! I can't explain why.

For the record I did try Regulation, braking, state-running, and other possibilities. No luck so far, so I was wondering if you guru's Smiley Wink could point out the direction to solve this.

Fredje AKA GGGss (from Belgium) new labview user


Download All
0 Kudos
Message 15 of 23

Hi guys:

After I post this thread at 12/15/06,I began to study how the actuating motor worked. NXT used this kind of motor.

To make it work, a runtime feedback must be essential. For example,if we want it rotate 120 degree,we give it power,let the moto run,and check the current degree very fast.When the feedback degree is =120,then cut the motor power or force it stop. 

All these functions must run very fast. However, usb or bluetooth connect are not fast(have not realtime feature).For this reason,we hardly get the real current motor degree and also can not stop the motor at we wanted time.

This is why NI does not provides motor degree control feature in it's NXT direct commands tools but provides this kind of features in NXTtoolkit which must be downloaded in your NXT and run on NXT.

For this reason,I think in the future version of Ni NXT tools,we can not see this feature aslo.

0 Kudos
Message 16 of 23
Aah! It figures! So we can close this thread.
0 Kudos
Message 17 of 23
What we can try todo is to issue a command that is executed in the nxt.
So a working together of the toolkit an the local nxt executing.

greetings from the Netherlands
0 Kudos
Message 18 of 23

I have created the rotate by degrees program but there is an error which i can't figure out how to fix. I am using version 8.2. Could someone please assist me. Thanks.

0 Kudos
Message 19 of 23



I would like to generate oscillation with one motor. Have you got a solution for me ? 






0 Kudos
Message 20 of 23