upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes
HDXXVXTA Class Reference

API for the Veris HDXXVXTA Humidity Transmitter. More...

Detailed Description

The driver was developed using the HD2NVSTA1 humidity transmitter. The 'T' variant supports a temperature transmitter as well. Both signals are provided by the device as analog 0-5Vdc or 0-10Vdc outputs. The A1 variant supports a temperature range of -40C-50C, while the A2 variant supports a range of 0C-50C. Humidity ranges for all devices in this device family range from 0% to 100% (non-condensing).

This driver used the 5Vdc outputs for obvious reasons. Your MCU must be configured for 5V operation. Using any other analog reference voltage will require the appropriate external circuitry (such as a voltage divider) in order to interface safely with your MCU.

For devices which do not support temperature, use '-1' as the temperature pin number in the object constructor. If temperature measurement is disabled, getTemperature() will always return 0C/32F.

cout << "Initializing..." << endl;
// Instantiate an HDXXVXTA instance, using A1 for humidity and A0
// for temperature
upm::HDXXVXTA *sensor = new upm::HDXXVXTA(1, 0);
// update and print available values every second
while (shouldRun)
{
// update our values from the sensor
sensor->update();
// we show both C and F for temperature
cout << "Temperature: " << sensor->getTemperature()
<< " C / " << sensor->getTemperature(true) << " F"
<< endl;
cout << "Humidity: " << sensor->getHumidity()
<< " %" << endl;
cout << endl;
sleep(1);
}
cout << "Exiting..." << endl;
delete sensor;

Public Types

enum  RANGE_T { RANGE_MINUS40_50 = 1, RANGE_0_50 = 2 }
 

Public Member Functions

 HDXXVXTA (int hPin, int tPin, float aref=HDXXVXTA_DEFAULT_AREF)
 
 ~HDXXVXTA ()
 
void setRange (RANGE_T range=RANGE_MINUS40_50)
 
void update ()
 
float getTemperature (bool fahrenheit=false)
 
float getHumidity ()
 

Protected Attributes

mraa::Aio * m_aioTemp
 
mraa::Aio m_aioHum
 

Constructor & Destructor Documentation

HDXXVXTA ( int  hPin,
int  tPin,
float  aref = HDXXVXTA_DEFAULT_AREF 
)

HDXXVXTA object constructor

Parameters
hPinAnalog pin to use for the humidity measurement
tPinAnalog pin to use for temperature. If your device does not support temperature, use -1 as the value so that temperature will not be queried and an analog pin won't be wasted.
arefThe analog reference voltage, default 5.0

Here is the call graph for this function:

~HDXXVXTA ( )

HDXXVXTA object destructor

Member Function Documentation

void setRange ( RANGE_T  range = RANGE_MINUS40_50)
inline

Set the temperature range of the sensor. HD*A1 sensors support a range of -40C-50C, while HD*A2 devices support a temperature range of 0C-50C. The constructor sets a default of RANGE_MINUS40_50.

Parameters
Oneof the RANGE_T values, default is RANGE_MINUS40_50

Here is the caller graph for this function:

void update ( void  )

Read current values from the sensor and update internal stored values. This method must be called prior to querying any values, such as temperature or humidity.

float getTemperature ( bool  fahrenheit = false)

Get the current temperature. update() must have been called prior to calling this method. If temperature measurement was disabled (by passing -1 as the temperature pin in the constructor) then this function will always return 0C/32F.

Parameters
fahrenheittrue to return the temperature in degrees fahrenheit, false to return the temperature in degrees celcius. The default is false (degrees Celcius).
Returns
The last temperature reading in Celcius or Fahrenheit
float getHumidity ( void  )

Get the current relative humidity. update() must have been called prior to calling this method.

Returns
The last humidity reading

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