Component: Ultrasonic (HCSR04) (Audio)

From Flowcode Help
Revision as of 11:40, 9 August 2021 by BenR (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Audio


Image Ultrasonic (HCSR04) component

This board has both an ultrasonic transmitter and receiver. The transmitter is driven by an on-board 40KHz oscillator which is enabled by the host microprocessor. The receiving sensor signal is amplified and provided as an analogue signal to be processed by a single channel ADC of the microprocessor. By measuring the time delay between enabling a transmit pulse and receiving an echo the distance of objects in a range of around 3cm to 3m 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