Easyuino  1.2.0
Easyuino::WaterDetector Class Reference

RainDetector API is used to detect the amount of water that is touching the sensor. More...

#include <WaterDetector.h>

Inheritance diagram for Easyuino::WaterDetector:
Easyuino::Device

Public Member Functions

 WaterDetector (IN uint8_t digitalPin, IN uint8_t analogPin)
 Constructor. More...
 
 ~WaterDetector ()
 Destructor.
 
bool begin ()
 Used to put the device ready to receive requests. More...
 
bool begin (IN uint8_t digitalPinTriggerLevel)
 Initialize the WaterDetector API putting it ready to receive requests. More...
 
void end ()
 Used to stop the device API. More...
 
WaterStatus getWaterStatus ()
 Returns an enumerate value depending on how wet is the sensor. More...
 
unsigned int getWaterStatusRange ()
 Return a number in [0,1023] depending on dry is the sensor. More...
 
bool isWaterDetected ()
 Used to get the value from the digital pin that is activated when a wet threshold is passed. 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 Attributes inherited from Easyuino::Device
bool _isInitialized
 Used to know if the device API is initialized and ready to receive requests.
 

Detailed Description

RainDetector API is used to detect the amount of water that is touching the sensor.

Constructor & Destructor Documentation

◆ WaterDetector()

Easyuino::WaterDetector::WaterDetector ( IN uint8_t  digitalPin,
IN uint8_t  analogPin 
)

Constructor.

Parameters
digitalPinArduino pin connected to digital pin (Normally D0 in sensor board)
analogPinArduino pin connected to analog pin (Normally A0 in sensor board)

Member Function Documentation

◆ begin() [1/2]

bool Easyuino::WaterDetector::begin ( )
virtual

Used to put the device ready to receive requests.

Normally this have some default behaviour some devices have other overload method with same name that receives other arguments to device customization.

Returns
True: If the device was initialized. False: Otherwise.

Implements Easyuino::Device.

◆ begin() [2/2]

bool Easyuino::WaterDetector::begin ( IN uint8_t  digitalPinTriggerLevel)

Initialize the WaterDetector API putting it ready to receive requests.

Parameters
digitalPinTriggerLevelThe digital level that is triggered in digital pin when water is sensed.
Returns
True: If the device was initialized. False: Otherwise.

◆ end()

void Easyuino::WaterDetector::end ( )
virtual

Used to stop the device API.

After this the the device will not process API requests.

Implements Easyuino::Device.

◆ getWaterStatus()

WaterStatus Easyuino::WaterDetector::getWaterStatus ( )

Returns an enumerate value depending on how wet is the sensor.

Returns
waterStatus Available options in WaterStatus enumerate.

◆ getWaterStatusRange()

unsigned int Easyuino::WaterDetector::getWaterStatusRange ( )

Return a number in [0,1023] depending on dry is the sensor.

Used in getWaterStatus() method.

Returns
Number in range [0,1023], 1023 = dry and 0 = flood or -1 if API is not initialized

◆ isWaterDetected()

bool Easyuino::WaterDetector::isWaterDetected ( )

Used to get the value from the digital pin that is activated when a wet threshold is passed.

Normally the threshold is set using the potentiometer in the water detector board.

Returns
True: If water threshold detection passed. False: Otherwise.

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