Difference between revisions of "Component: Ultrasonic (HCSR04) (Audio)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
Line 17: Line 17:
 
==[[File:Component Icon c5d9ffa3_5a7d_4fb2_b9ba_ec855ad7b25c.png|Image]] Ultrasonic (HCSR04) component==
 
==[[File:Component Icon c5d9ffa3_5a7d_4fb2_b9ba_ec855ad7b25c.png|Image]] Ultrasonic (HCSR04) component==
 
This  board  has  both  an  ultrasonic  transmitter  and receiver.  
 
This  board  has  both  an  ultrasonic  transmitter  and receiver.  
The transmitter is driven by an on-board 40KHz  
+
When the Trig pin is set high for 10uS, the transmitter sends eight 40KHz pulses.
oscillator which is enabled by the host microprocessor.  
+
The Echo pin goes high about 2ms later.  
The receiving sensor signal is amplified and provided as an analogue signal to be processed by a single channel
+
The duration of the Echo pin is measure when it goes high, and a distance is then calculated based on the high duration.
ADC of the microprocessor. By measuring the time delay between  enabling  a  transmit  pulse  and  receiving  an
+
The distance of objects in a range of around 3cm to 2.75m can be determined.
echo the distance of objects in a range of around 3cm to 3m can be determined.
 
  
 
==Examples==
 
==Examples==

Revision as of 19:18, 9 August 2021


Author Matrix TSL
Version 1.0 (Release)
Category Audio


Image Ultrasonic (HCSR04) component

This board has both an ultrasonic transmitter and receiver. When the Trig pin is set high for 10uS, the transmitter sends eight 40KHz pulses. The Echo pin goes high about 2ms later. The duration of the Echo pin is measure when it goes high, and a distance is then calculated based on the high duration. The distance of objects in a range of around 3cm to 2.75m can be determined.

Examples

No additional examples


Downloadable macro reference

GetDistance

Sends a pulse and processes the echo.

Returns a object distance in cm

Parameters

This macro has no parameters


Return value

UINT


Simulation macro reference

This component does not contain any simulation macros


Property reference

OutputTrig Pin

This property is of type Single digital pin and can be referenced with the variable name OPP.

Pin used for controlling the output pulse

Input Echo Pin

This property is of type Single digital pin and can be referenced with the variable name ECHO.

ADC channel used to monitor the echo