Easyuino  1.2.0
Easyuino::DistanceMeterPrintable Class Reference

It offers the same API as DistanceMeter plus some methods to print the internal state into a stream for example. More...

#include <DistanceMeterPrintable.h>

Inheritance diagram for Easyuino::DistanceMeterPrintable:
Easyuino::DistanceMeter Easyuino::Printable Easyuino::Device

Public Member Functions

 DistanceMeterPrintable (IN uint8_t triggerPin, IN uint8_t echoPin)
 Constructor similar to the DistanceMeter one. More...
 
 ~DistanceMeterPrintable ()
 Destructor.
 
char * toString () const
 Used to return a string representation of the object state. More...
 
- Public Member Functions inherited from Easyuino::DistanceMeter
 DistanceMeter (IN uint8_t triggerPin, IN uint8_t echoPin)
 Constructor. More...
 
 DistanceMeter (IN uint8_t triggerEchoPin)
 Contructor used with Ultrasonic Modules that have only one pin for trigger and echo. More...
 
 ~DistanceMeter ()
 Destructor.
 
bool begin ()
 Used to put the device ready to receive requests. More...
 
void end ()
 Used to stop the device API. More...
 
virtual float getDistanceCentimeters ()
 Gets the last value that the API measured using the Ultrasonic Module. More...
 
float getDistanceInches ()
 Gets the last value that the API measured using the US. More...
 
virtual void updateDistance ()
 Updates the distance of the Ultrasonic Module to the objects in a blocking way. More...
 
- Public Member Functions inherited from Easyuino::Device
 Device ()
 Constructor called by every sub-classes.
 
 ~Device ()
 Destroy all the resources associated with the device.
 
bool isInitialized () const
 Verify is the device is initialized and ready to use. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Easyuino::DistanceMeter
float executeUpdateDistanceBlock (IN float soundSpeed)
 Execute a block distance measurement and calculates the distance based on the sound speed. More...
 
- Protected Attributes inherited from Easyuino::DistanceMeter
uint8_t _triggerPin
 Arduino pin used to trigger the echo wave emission.
 
uint8_t _echoPin
 Arduino pin that is set to LOW by when reflected echo wave arrives.
 
volatile bool _isEchoing
 Used to know if it is in a middle of a measurement.
 
volatile float _distance
 It contains a cached value of the last distance measured. More...
 
- Protected Attributes inherited from Easyuino::Device
bool _isInitialized
 Used to know if the device API is initialized and ready to receive requests.
 

Detailed Description

It offers the same API as DistanceMeter plus some methods to print the internal state into a stream for example.

Useful for debugging purposes.

See also
Devices Supported: HC-SR03, HC-SR04, HC-SR05
Devices Tested: HC-SR04

Constructor & Destructor Documentation

◆ DistanceMeterPrintable()

Easyuino::DistanceMeterPrintable::DistanceMeterPrintable ( IN uint8_t  triggerPin,
IN uint8_t  echoPin 
)

Constructor similar to the DistanceMeter one.

Parameters
triggerPinArduino pin connected to the trigger pin of the Ultrasonic Module
echoPinArduino pin connected to the echo pin of the Ultrasonic Module

Member Function Documentation

◆ toString()

char* Easyuino::DistanceMeterPrintable::toString ( ) const
virtual

Used to return a string representation of the object state.

IMPORTANT: It is mandatory to free the returned pointer in order to have no memory leaks.

Implements Easyuino::Printable.


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