LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 

incrementing and decrementing variable

Go to solution

incrementing and decrementing variable

Hi guys

I´m new in Labview Programming and I´m working with the  NXT module in Labview 2010, and I have some problems, because I´m used to the C programming

and LabView is kind of diferent than C


The thing is wath I wanna make a speed regulator using the NXT brick


Using the left arrow button the speed will increase and using the right arrow button the speed will decrease


I´m usin the servomotor connected to the PORT A of the NXT brick, 





0 Kudos
Message 1 of 8

Re: incrementing and decrementing variable

I get this code working properly but I don´t know why sometimes when I press the Left Arrow Button of the NXT Brick, The screen shows "Speed of Motor : -1" and everything just Stop and don´t work again, I have to reset the NXT brick to get it working again.


What are the NXT terminal of each one of the NXT VI of Labview? I see each one of the Lego VI have a NXT input and a NXT output and How do I have to connect this NXT Terminals for my code?


Thank you for answer




0 Kudos
Message 2 of 8

Re: incrementing and decrementing variable

Hi Diego,

When I ran your NXT program it worked fine except that the last digit of your display was getting cut off because the string was too long.  so (-10 through -19 all displayed as -1). You may want to format your string differently or use two lines. Do you think this is what you saw or is it something else?


The "NXT Terminals" on each NXT subVI are used primarily for sequencing. When you are targetting an NXT they do not carry any data but allow you to specify which subVI will execute first, second, and so on.

When targetting the computer they are a little more important because the pink NXT wire contains a reference to the NXT brick that is being used.

0 Kudos
Message 3 of 8

Re: incrementing and decrementing variable

yeah, my message on the screen was pretty large and now i already fixed and everithing is going fine but

about the NXT terminals, in my code i didn´t connect any of them and everithing is going fine, maybe i was lucky and there is no problem


But, how Do I connect the NXT terminals in my code? 





0 Kudos
Message 4 of 8

Re: incrementing and decrementing variable

Yes it doesn't matter in your program because it does not make a differnence whether you display the message string first, or whether you set the motor speed first. If for some reason you wanted to force those two actions to execute in a specific order, you would wire the NXT output terminal of the first, to the NXT input terminal of the second. In your case it is fine as you have it.



0 Kudos
Message 5 of 8

Re: incrementing and decrementing variable

O´right I will keep it in mind  for my next designs.


I read in a blog something about connect other stuffs didn´t maked by LEGO to the NXT brick something like a DAC or ADC I2C integrated circuits, they said that the NXT inputs use the I2C protocol, and I know how I2C works but Do yo know where can I find more information about use the NXT inputs for interface my own sensors? and if the 4 inputs of NXT brick use I2C protocol, what kind of protocole use the 3 outputs


Thanks in advance


0 Kudos
Message 6 of 8
Accepted by topic author HxcBarrigaHxc
08-27-2015 04:09 PM

Re: incrementing and decrementing variable

There is an i2c communication vi on the NXTI/O : Advanced palette that you can use to read/write i2c data. You can take a look at the Ultrasonic sensor VI, or the HiTechnic sensor vis for examples of how to use this vi. You will also need to configure the sensor port for i2c use. You can use the "Setup Sensor Port" VI also on the advanced palette to set the port for Lowspeed9V / RawMode

Message 7 of 8

Re: incrementing and decrementing variable

Thank you ESearl your information will ve very helpfull

0 Kudos
Message 8 of 8