From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

New NXT-G block, need some help

Hi Mindstorm...,
what do you wanna see and where? From where do you call this vi?
Mike
0 Kudos
Message 11 of 28
(5,117 Views)
I want it to tell the robot how fast the motors are moving, on a rank of 0 to 100 (0 = 0, and 100 = 8.5, if you are testing every 10ms). The SubVI is being called from speed_test.vi, which is on another post. It (should) run the motor forever, and display the speed.
0 Kudos
Message 12 of 28
(5,113 Views)
Hi MindstormsKid,
in your speed_test.vi is no loop, so it don´t run forever. Your while loops in the sub vi will never stop. Please explain where and what you wanna show.

Mike
0 Kudos
Message 13 of 28
(5,101 Views)
I saw what you meant, and changed them both. It now sorta works. But first:

I'll explain EXACTLY what I want:

First, I tested a motor, that had the max possible amps. I found that it does about 850 degrees in one second of the motor running at 100 power (I used NXT-G). I wanted to make a block that could tell me how fast the motors were running, based on how many rotations there were every 10ms.

Ok, that's all. I made a new version of both, and now it sort of works. The number it displays is between 25 and 30 in my tests (it should be 95-100). Part of that problem was that it won't allow numbers with decimals in them on the NXT. Any idea on how that can be fixed? And even if it was 8.5, it wouln't get the number to 90.
Download All
0 Kudos
Message 14 of 28
(5,097 Views)
Hi MindstormsKid,
to fix it you can calcualte with 80 instead of 8 and change only the view. Make all internal calculations with integers. Why do you connect 0,1,3 to the ports? If you want to use numbers, then Port C is 2 instead of 3.

Mike
0 Kudos
Message 15 of 28
(5,091 Views)
Ok, now it works, but when I set it to 85 on the SubVI, and 100ms wait on speed_test.vi, it will display a number before and after the speed.
Download All
0 Kudos
Message 16 of 28
(5,089 Views)
Hi MindstormsKid,
what do you mean with before and after? It can only show it ones per iteration.
Mike
0 Kudos
Message 17 of 28
(5,087 Views)
I meant on the NXT's screen (e.g. 6970, where 97 is the speed).
0 Kudos
Message 18 of 28
(5,085 Views)
Hi MindstormsKid,
ok, i understand what you mean, but 697 is what you, right?  And because you know that it is 10 times more you can cut the string acording to it.

Hope it helps.
Mike
0 Kudos
Message 19 of 28
(5,073 Views)
No, I wanted it to display 97, so I divided it by 100. It now does everything correctly. However, every time I download it, it gives me a warning because the divided value is floating-point. Also, it resets the rotation sensor every every time it runs, so it will mess up some programs. Is there any way to not use this (e.g. using math)?
0 Kudos
Message 20 of 28
(5,071 Views)