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

From Flowcode Help
Jump to navigationJump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Audio
 
| 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.
  
==[[File:Component Icon c5d9ffa3_5a7d_4fb2_b9ba_ec855ad7b25c.png|Image]] Ultrasonic (HCSR04) component==
+
==Component Pack==
This  board  has  both  an  ultrasonic  transmitter  and receiver.
+
 
When the Trig pin is set high for 10uS, the transmitter sends eight 40KHz pulses.
+
SENSORS
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.
+
==Detailed description==
The distance of objects in a range of around 3cm to 2.75m can be determined.
+
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
''No detailed description exists yet for this component''
  
 
==Examples==
 
==Examples==
{{Fcfile|HC-SR04 Distance Sensor Demo.fcfx|HC-SR04 Distance Sensor Demo.fcfx}}
 
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>GetDistance</tt></u></span>===
 
Sends a pulse and processes the echo.
 
  
Returns a object distance in cm
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
+
{{Fcfile|HC-SR04 Distance Sensor Demo.fcfx|HC-SR04 Distance Sensor Demo.fcfx}}
  
 +
==Downloadable macro reference==
  
==Property reference==
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
<span style="font-weight: normal;"><u>OutputTrig Pin</u></span>
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDistance'''
 +
|-
 +
| colspan="2" | Sends a pulse and processes the echo. Returns a object distance in cm&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''OPP''.
 
  
Pin used for controlling the output pulse
 
  
<span style="font-weight: normal;"><u>Input Echo Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''ECHO''.
+
==Property reference==
  
ADC channel used to monitor the echo
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | OutputTrig Pin
 +
|-
 +
| colspan="2" | Pin used for controlling the output pulse&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 +
| width="90%" | Input Echo Pin
 +
|-
 +
| colspan="2" | ADC channel used to monitor the echo&nbsp;
 +
|}

Latest revision as of 17:23, 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 Pack

SENSORS

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