C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
HC_SR04 Class Reference

class for the ultrasonic ranging module HC-SR04 More...

#include <hc_sr04.h>

Collaboration diagram for HC_SR04:
Collaboration graph

Public Member Functions

 HC_SR04 (uint trig_pin, uint echo_pin)
 Construct a new hc sr04 object.
 
float get_distance ()
 request a measure from HC_SR04
 

Detailed Description

class for the ultrasonic ranging module HC-SR04

Constructor & Destructor Documentation

◆ HC_SR04()

HC_SR04::HC_SR04 ( uint trig_pin,
uint echo_pin )

Construct a new hc sr04 object.

Parameters
trig_pinthe pin attached to the triggering signal
echo_pinthe pin used to measure round-trip time of ultrasonic pulses

Member Function Documentation

◆ get_distance()

float HC_SR04::get_distance ( )

request a measure from HC_SR04

Returns
the measured distance in float[cm]. Max = 400cm. If no response, return = -1.

The documentation for this class was generated from the following files: