27 #ifndef _EASYUINO_DISTANCE_METER_h 28 #define _EASYUINO_DISTANCE_METER_h 30 #include "Utilities.h" 34 #define ECHO_TIMEOUT_MICROS 30000UL 36 #define DELAY_AFTER_TRIGGER_LOW_MICROS 2 38 #define ECHO_PULSE_DURATION_MICROS 10 41 #define DEFAULT_AIR_TEMPERATURE_CELSIUS 20.0f 43 #define DEFAULT_SOUND_SPEED_CM_PER_SEC 34340.0f float getDistanceInches()
Gets the last value that the API measured using the US.
Used to represent the at least supported Ultrasonic Module models enum UltrasonicModule : uint8_t { H...
Definition: DistanceMeter.h:59
~DistanceMeter()
Destructor.
uint8_t _triggerPin
Arduino pin used to trigger the echo wave emission.
Definition: DistanceMeter.h:63
DistanceMeter(IN uint8_t triggerPin, IN uint8_t echoPin)
Constructor.
bool begin()
Used to put the device ready to receive requests.
virtual void updateDistance()
Updates the distance of the Ultrasonic Module to the objects in a blocking way.
volatile bool _isEchoing
Used to know if it is in a middle of a measurement.
Definition: DistanceMeter.h:67
float executeUpdateDistanceBlock(IN float soundSpeed)
Execute a block distance measurement and calculates the distance based on the sound speed...
volatile float _distance
It contains a cached value of the last distance measured.
Definition: DistanceMeter.h:69
General class that provides the common API behaviour for all the devices/sensors. ...
Definition: Device.h:42
virtual float getDistanceCentimeters()
Gets the last value that the API measured using the Ultrasonic Module.
uint8_t _echoPin
Arduino pin that is set to LOW by when reflected echo wave arrives.
Definition: DistanceMeter.h:65
void end()
Used to stop the device API.