LabVIEW Ultrasonic Sensor

I want to use an ultrasonic sensor so that i have my motor unable to turn on until I get close enough to the wall. I have never used this sensor before and this is my first year ever using labview. If you have any sources or just any help I would love the feedback thanks!

Which model ultrasonic sensor are you using or wish to use? If you do not have one already, I can provide some guidance on using a Maxbotix one (coupon in KOP).

I suggest you select to the Help>>Find Examples in the menubar. See if there is an example for the specific sensor. Use that example’s panel and code to explore its capabilities and how to use it. If you decide it is the right one to put on your root, there is a tutorial in the Getting Started window about the specifics of integrating example code into your robot code.

Greg McKaskle

We just put together a video on how to do this. Here is the link to it http://youtu.be/npkDcDyke48. Let me know how it goes

We are using this sensor http://www.amazon.com/SainSmart-HC-SR04-Ranging-Detector-Distance/dp/B004U8TOE6 How ever we do have the maxbotix sensor if that is an easier sensor to code I would be happy to use it (maybe a little help with wiring please! :p)
I have some pictures of my code that (I thought it would work this way) so maybe just helping edit that would be helpful!
Thanks very much!!

Here are some screenshots of my code so far hope this helps! http://imgur.com/a/yPXoB

As Greg mentioned above, in LabVIEW you can use Help>>Find Examples… and then look at the Ultrasonic example.

How I can read Sensor like HC-SR04 WITH LABVIEW, Just a simple code for beginner.
I try to study https://wpilib.screenstepslive.com/s/4485/m/13811/l/288893-waiting-for-target-to-respond-recovering-from-bad-loops
did not help

Follow the advice from Greg McKaskle and Doug Norman above!

LabVIEW Help>> Find Examples
Study the examples that are included in the FRC updates.

Are you having problems with endless loops?

I am so far from that just how to write code to read the Ultrasonic Sensor HC-SR04 by LABVIEW, Just a simple code for beginner.

If you are trying to use the ultrasonic sensor, there are a total of five icons.

Open tells the SW what pins you have wired the sensor to and what kind of sensor it is.

GetRange returns a distance number based on how it is configured.

Get and Set Refnum allow you to store and retrieve the opened refnum so that you can use it other places.

Close is how you release the pins so they could be reopened for something else.

It sounds like you may have other, more basic issues, but I can’t be sure what they are.

Feel free to ask more basic questions. Everyone has to start in the way that is right for them, and that is easier with good questions.

Without knowing more, I’d suggest that you go through the tutorials on the Getting Started tab. It will help with imaging the hardware, installing the software, and opening template and example code and making use of it. Also, consider doing these tasks with a mentor or other students.

Good luck,
Greg McKaskle

thanks I found a nice Example in LV and in fourm NI
Arduino sensor code.txt (583 bytes)
ultrasonic sonar module 1r0.pdf (321.7 K)
US-100 ultrasonic my code.vi (41.2 K) https://decibel.ni.com/content/servlet/JiveServlet/download/62811-72953/US-100%20ultrasonic%20my%20code.vi

The code you found will help you to read a value from an arduino mounted ultrasonic sensor.

The code for LabVIEW FRC examples will help with one connected to a roboRIO. Do you have all of the software installed so that you can look at examples and tutorials? If not, be sure to install the software update after installing the DVD.

Greg McKaskle

Yes I have every thing now it is clear with nice Example