LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 

Extracting data from ultrasonic sensors

Hi guys, I have an idea how to solve my problem, but im not very skilful at labview. So, I want to compare the data from two ultrasonics sensor blocks. Like these::sensors.png These blocks output a value in centimeters. I want measure the difference between the value detect by them. So let's say one detects 4cm and the second detects 6 cm. I want to get the difference calculated from those blocks. like 6 - 4 = 2cm. Maybe displayed in some block. Does anyone know how to do it? I think it can be done. So I beg you, and then I want to based on that difference make 'less than' comparison and case structure, but that I can do it I hope. Please help me. I can clarify further if I did it badly so far.

0 Kudos
Message 1 of 4

Hi Kamkaj

I don't uderstand where is the problem, but if You want to calculate the difference You need to use subtract function.

If You want to display the result You need to create an indicator.


Please write some more description of Your problem and attach the VI to be sure we are on the same page 🙂


Please write a feedback



0 Kudos
Message 2 of 4

..and that shows I'm silly about labview;D, thanks a lot for your answer.  In general I want to program a robot using two ultrasonic sensors that will recognize three shapes, it does two for now and I'm struggling with the third shape(flat one). Sensors are placed one over the other. Shapes like these:and this.pngSo first two I do by comparing distances from upper and lower sensor. If upper is closer then avoid, if upper is farther then push,  And the flat one i wanted to recognize if the difference between distances too small. I didnt think i could just subtract ;D. I'll try that.

If i copy a vi it shows only the interface part for some reason, not block diagram. But here is the screenshot:here.jpg

0 Kudos
Message 3 of 4

Hi Kamkaj


If I understand properly You should use functions from comparison palete:


I attach my Idea to implement Your fiunctionality.




Please test nad write a feedback (VI was created in LV 2015).


Best Regards

Download All
0 Kudos
Message 4 of 4