Honza T. / Distance_HC_SR04

Dependents:   TEST_Dist_lib

Embed: (wiki syntax)

« Back to documentation index

Distance_HC_SR04.h File Reference

Distance_HC_SR04.h File Reference

Library for distance measurement with device HC-SR04 and similar. More...

Go to the source code of this file.

Data Structures

class  Distance_HC_SR04
 Distance_HC_SR04 class. More...

Enumerations

enum  Distance_HC_SR04_state {
  IDLE, STARTED, COMPLETED, TIMEOUT,
  OUT_OF_RANGE_MIN, OUT_OF_RANGE_MAX, ERROR_SIG
}
 

Definition of measurement FSM states.

More...

Detailed Description

Library for distance measurement with device HC-SR04 and similar.

Author:
Jan Tetour
Date:
21. Dec 2015 Synchronous and asynchronous library for ultrasonic distance measurement for the device HC-SR04 with error handling functionality (out of range detection, HW error detection). Main features: "echo" puls duration measurement, distance measurement from "echo" pulse duration, detection of "echo" signal malfunction, timeout detection, detection of measured values outside reliable limits (min, max)
See also:
https://os.mbed.com/users/dzoni/code/Distance_HC_SR04/

Definition in file Distance_HC_SR04.h.


Enumeration Type Documentation

Definition of measurement FSM states.

Measurement FSM (Finite State Machine) states definition.

Enumerator:
IDLE 

No activity.

Ready to start measurement with trigger(). This is state after reset().

STARTED 

Measurement started and in progress.

This is state after trigger().

COMPLETED 

Measurement succesfuly completed by falling edge of echo signal.

Measured values in range.

TIMEOUT 

It was not possible to complete echo pulse width measurement in given time.

Measurement cancelled.

OUT_OF_RANGE_MIN 

Measurement completed.

Measured distance under reliable range.

OUT_OF_RANGE_MAX 

Measurement completed.

Measured distance over reliable range.

ERROR_SIG 

Faulty value of echo signal just after trigger pulse (echo != 0).

Possible HW fault.

Definition at line 28 of file Distance_HC_SR04.h.