Simple_HCSR04
A simple wrapper for the HC-SR04 Module to be used for e.g. an Arduino.
Classes | Public Member Functions | List of all members
Simple_HCSR04 Class Reference

A simple wrapper for measuring the distance with an HC-SR04 Module. More...

#include <Simple_HCSR04.h>

Classes

class  Measurement
 A simple wrapper for holding the measured distance. More...
 

Public Member Functions

 Simple_HCSR04 (const short echo_pin, const short trig_pin)
 Construct a new Simple_HCSR04::Simple_HCSR04 object and initializes the pin mode for the given pins. More...
 
short getEchoPin () const
 Getter for the Echo pin. More...
 
short getTrigPin () const
 Getter for the Trig pin. More...
 
Measurementmeasure ()
 Measures the distance between the module and the object in front of it. Warning: this function needs at least 12 milliseconds to execute. More...
 

Detailed Description

A simple wrapper for measuring the distance with an HC-SR04 Module.

Constructor & Destructor Documentation

◆ Simple_HCSR04()

Simple_HCSR04::Simple_HCSR04 ( const short  echo_pin,
const short  trig_pin 
)

Construct a new Simple_HCSR04::Simple_HCSR04 object and initializes the pin mode for the given pins.

Parameters
echo_pinEcho pin on the microcontroller (warning, is being cast to an unsigned short).
trig_pinTrig pin on the microcontroller (warning, is being cast to an unsigned short).

Member Function Documentation

◆ getEchoPin()

short Simple_HCSR04::getEchoPin ( ) const

Getter for the Echo pin.

Returns
short

◆ getTrigPin()

short Simple_HCSR04::getTrigPin ( ) const

Getter for the Trig pin.

Returns
short

◆ measure()

Simple_HCSR04::Measurement * Simple_HCSR04::measure ( )

Measures the distance between the module and the object in front of it. Warning: this function needs at least 12 milliseconds to execute.

Returns
Simple_HCSR04::Measurement*

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