upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

UPM module for the Grove Water Level Switch. More...

Detailed Description

This switch is a device used to sense the level of liquid within a tank, it may actuate a pump, an indicator, an alarm, or other devices.

waterlevel.jpg
// The was tested with the Water Level Sensor
// Instantiate a Water Level Sensor on digital pin D2
upm::WaterLevel waterlevel(2);
while (shouldRun) {
if (waterlevel.isSubmerged())
cout << "Sensor is submerged in liquid" << endl;
else
cout << "Liquid is below water level sensor" << endl;
upm_delay(1);
}

Public Member Functions

 WaterLevel (int pin)
 
 ~WaterLevel ()
 
bool isSubmerged ()
 

Constructor & Destructor Documentation

WaterLevel ( int  pin)

WaterLevel constructor

Parameters
pinDigital pin to use
~WaterLevel ( )

WaterLevel destructor

Member Function Documentation

bool isSubmerged ( )
Returns
bool Determines whether liquid has risen above the sensor

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