VEX Ultrasonic Sensor

So, I’ve been trying to get the the VEX ultrasonic sensor to work with the cRIO. I’ve created a while loop in which I have a “wait”, the Ping VI, and the Get Distance VI. Outside of the loop I have the respective Open and Close VIs for Ultrasonic sensors.

It /partially/ works. If I run it normally, I receive the distance to whatever object was in front of the sensor when I hit run. This also happens if I tell it to run continuously. Also, I attached a display to the loop timer. This timer stops updating after a period of time.

BUT: If I ask it to highlight execution it will update the distance as fast as the highlights move.

Essentially, I get a distance out of it, but it won’t update the distance.

I think the problem may lie in the respective lengths of the ping time and the loop wait time. Also, I am using the second update of Labview.

Any pointers? Tips? Attached is my code with some comments detailing the situation.

Ultrasonic_Senor_Robot.zip (130 KB)


Ultrasonic_Senor_Robot.zip (130 KB)

There is a known issue in Update 2 with ultrasonic sensors, which causes GetRange to never return if the sensor never hears an echo. See http://forums.usfirst.org/showthread.php?t=10972 or http://www.chiefdelphi.com/forums/showthread.php?t=72452 for other threads on the same topic.

Update 3 fixes this problem, your code should work as desired after you update.