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

From Flowcode Help
Jump to navigationJump to search
Line 15: Line 15:
 
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.  
 
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.  
  
==Component Pack==
+
==Component Source Code==
  
SENSORS
+
Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_HC_SR04.fcfx FC_Comp_Source_HC_SR04.fcfx]
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 32: Line 34:
  
 
==Examples==
 
==Examples==
 +
 +
  
  
Line 78: Line 82:
 
|-
 
|-
 
| colspan="2" | ADC channel used to monitor the echo 
 
| colspan="2" | ADC channel used to monitor the echo 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
 
|-
 
 
|}
 
|}

Revision as of 17:47, 9 November 2022

Author Matrix TSL
Version 1.0
Category Audio


Ultrasonic 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.

Component Source Code

Please click here for the component source code: FC_Comp_Source_HC_SR04.fcfx

Detailed description

No detailed description exists yet for this component

Examples

FC6 Icon.png HC-SR04 Distance Sensor Demo.fcfx

Downloadable macro reference

Fc9-comp-macro.png GetDistance
Sends a pulse and processes the echo. Returns a object distance in cm 
Fc9-u16-icon.png - UINT Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-5-icon.png OutputTrig Pin
Pin used for controlling the output pulse 
Fc9-type-5-icon.png Input Echo Pin
ADC channel used to monitor the echo