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.

Example Code

Ultrasonic range finding on a myRio using the HC-SR04

Code and Documents

Attachment

This program uses the FPGA and real-time controller to measure distance in cm using the HC-SR04 ultrasound module.

Unrar the attached files. Make the following connections from the ultrasound module to the myRio

 

Vcc to Pin 1 (+5v)

Gnd to Pin 12 (zero volts)

Trig to Pin 11

Echo to Pin 13

(all port A connector).

 

Compile the FPGA code. Then run the program Main on the real-time controller. A video of this is shown at the link below.

https://www.youtube.com/watch?v=J0DBf-Z5SjE&feature=youtu.be

HC.JPG

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
DavidMHoward
Member
Member
on

I would like to get this going but am new. However, the folder above will not extract as it states it is empty (size shows as 755 kB). Any help would be appreciated.

 

David

tomnz
Member
Member
on

Ok so it wasn't empty, the web page deleted it because it doesn't like .rar files. I don't have a zipper I am afraid. Email me and I can post it. Don't know why they don't like .rar.

tomnz
Member
Member
on

Have updated the file as requested. Sorry a bit was missing.

zvonko
Member
Member
on

Hello tomnz!

In your video you have mentioned that NI provided you with the code. Can you be more specific and help me trace down this source?

Regards,

zvonko

Habch
Member
Member
on

Can someone plz send me the code for an older version of labview? (2014)

Contributors