NI Home > Community > NI Discussion Forums

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Do you mean 
Reply
Member
HxcBarrigaHxc
Posts: 32
0 Kudos
Accepted 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, 

 

Thanks

 

Diego 

Member
HxcBarrigaHxc
Posts: 32
0 Kudos

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

Diego

 

 

Member
ESearl
Posts: 85
0 Kudos

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.

Member
HxcBarrigaHxc
Posts: 32
0 Kudos

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? 

 

 

 

 

Member
ESearl
Posts: 85
0 Kudos

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.

 

-Ethan

Member
HxcBarrigaHxc
Posts: 32
0 Kudos

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

Diego

Member
ESearl
Posts: 85

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

Member
HxcBarrigaHxc
Posts: 32
0 Kudos

Re: incrementing and decrementing variable

Thank you ESearl your information will ve very helpfull