
Read the echoPin, pulseIn() returns the duration (length of the pulse) in microseconds: Trigger the sensor by setting the trigPin high for 10 microseconds:
#Frc ultrasonic sensor labview serial
Begin Serial communication at a baudrate of 9600:

* Example code for HC-SR04 ultrasonic distance sensor with Arduino. By measuring how much time passed between sending and receiving the sound waves, the distance between the sensor and the object can be calculated. If there is an object in front of the sensor, the sound waves get reflected back and the receiver of the ultrasonic sensor detects them. These sound waves travel through the air with the speed of sound, roughly 343 m/s. Ultrasonic sensors work by emitting sound waves with a frequency that is too high for a human to hear. How does an ultrasonic distance sensor work? is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on.

#Frc ultrasonic sensor labview how to

Cheap ultrasonic distance/proximity sensors are great but in some projects, you might need a waterproof sensor like the JSN-SR04T or an IR sensor that isn’t influenced by temperature changes.
