JSN-SR04_Gen3_RK
Public Member Functions
JSN_SR04_Gen3::DistanceAlarmGreaterThan Class Reference

Helper class to configure a GREATER_THAN DistanceAlarm with the specified distance and default hysteresis. More...

#include <JSN-SR04_Gen3_RK.h>

Inheritance diagram for JSN_SR04_Gen3::DistanceAlarmGreaterThan:
JSN_SR04_Gen3::DistanceAlarm JSN_SR04_Gen3::Distance

Public Member Functions

 DistanceAlarmGreaterThan (Distance distance)
 This helper class is used to set a DistanceAlarm in GREATER_THAN mode with the specified distance and default settings. More...
 
- Public Member Functions inherited from JSN_SR04_Gen3::DistanceAlarm
DistanceAlarmwithDistance (Distance distance)
 Sets the distance for the alarm. More...
 
DistanceAlarmwithDirection (Direction direction)
 Direction LESS_THAN or GREATER_THAN. More...
 
DistanceAlarmwithHysteresis (Distance hysteresis)
 Hystersis value (default: 0.5 cm) More...
 
DistanceAlarmwithPeriod (std::chrono::milliseconds period)
 The period to test (default: 500 milliseconds, twice per second) More...
 
bool isValid () const
 Returns true if a distance has been configured. More...
 
- Public Member Functions inherited from JSN_SR04_Gen3::Distance
 Distance ()
 Construct a new Distance object with a distance of 0.
 
 Distance (double valueM)
 Construct a new Distance object with a distance in meters. More...
 
 Distance (const Distance &value)
 Construct a new Distance object from another Distance object. More...
 
Distanceoperator= (const Distance &value)
 Copy the distance value from another Distance object. More...
 
void setDistanceM (double distanceM)
 Set the Distance in meters. More...
 
double getDistanceM () const
 Get the Distance in meters. More...
 
void cm (double cm)
 Set the distance in centimeters. More...
 
double cm () const
 Get the value of the Distance in centimeters. More...
 
void mm (double mm)
 Set the distance in millimeter. More...
 
double mm () const
 Get the value of the Distance in millimeters. More...
 
void inch (double inch)
 Set the distance in inches. More...
 
double inch () const
 Get the value of the Distance in inches. More...
 

Additional Inherited Members

- Public Types inherited from JSN_SR04_Gen3::DistanceAlarm
enum class  Direction : int { LESS_THAN = -1 , GREATER_THAN = +1 }
 This enum specifies whether being in alarm is when the distance is less than or greater than the current distance. More...
 
- Data Fields inherited from JSN_SR04_Gen3::DistanceAlarm
Direction direction = Direction::LESS_THAN
 Stores the direction of the test. Default: LESS_THAN.
 
Distance hysteresis = 0.0005
 Stores the distance for hysteresis. Default: 0.5 cm.
 
unsigned long periodMs = 500
 How often check the sensor for alarm condition. More...
 
- Data Fields inherited from JSN_SR04_Gen3::Distance
double distanceM = 0.0
 The value of the distance in meters.
 

Detailed Description

Helper class to configure a GREATER_THAN DistanceAlarm with the specified distance and default hysteresis.

Constructor & Destructor Documentation

◆ DistanceAlarmGreaterThan()

JSN_SR04_Gen3::DistanceAlarmGreaterThan::DistanceAlarmGreaterThan ( Distance  distance)
inline

This helper class is used to set a DistanceAlarm in GREATER_THAN mode with the specified distance and default settings.

Parameters
distanceThe distance to alarm at, as a Distance object. You can pass a DistanceCm or DistanceInch object as the value if desired

Example:

.withDistanceAlarm( JSN_SR04_Gen3::DistanceAlarmGreaterThan( JSN_SR04_Gen3::DistanceCm(5.0) ) )


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