|
Nol.A SDK Library 26.11.2
For IoT System Software Development
|
#include <SHTSensor.hpp>
Public Types | |
| enum | SHTSensorType { AUTO_DETECT , SHT3X , SHT85 , SHT3X_ALT , SHTC1 , SHTC3 , SHTW1 , SHTW2 , SHT4X } |
| enum | SHTAccuracy { SHT_ACCURACY_HIGH , SHT_ACCURACY_MEDIUM , SHT_ACCURACY_LOW } |
Public Member Functions | |
| SHTSensor (SHTSensorType sensorType=AUTO_DETECT) | |
| virtual | ~SHTSensor () |
| Release the owned digital sensor driver. | |
| bool | init (TwoWire &wire) |
| bool | readSample () |
| float | getHumidity () const |
| float | getTemperature () const |
| bool | setAccuracy (SHTAccuracy newAccuracy) |
Public Attributes | |
| SHTSensorType | mSensorType |
| Sensor selection supplied to the constructor; configure before init(). | |
Static Public Attributes | |
| static const float | HUMIDITY_INVALID |
| static const float | TEMPERATURE_INVALID |
| static const SHTSensorType | AUTO_DETECT_SENSORS [] |
Official interface for Sensirion SHT Sensors
Accuracy setting of measurement. Not all sensors support changing the sampling accuracy.
Enum of the supported Digital Sensirion SHT Sensors. For analog sensors, see SHT3xAnalogSensor. Using the special AUTO_DETECT sensor causes all i2c sensors to be probed. The first matching sensor will then be used.
|
inline |
Instantiate a new SHTSensor By default, the i2c bus is queried for known SHT Sensors. To address a specific sensor, set the sensorType.
|
inlinevirtual |
Release the owned digital sensor driver.
|
inline |
Get the relative humidity in percent read from the last sample Use readSample() to trigger a new sensor reading
|
inline |
Get the temperature in Celsius read from the last sample Use readSample() to trigger a new sensor reading
| bool SHTSensor::init | ( | TwoWire & | wire | ) |
Initialize the sensor driver, and probe for the sensor on the bus
If SHTSensor() was created with an empty constructor or with 'sensorType' AUTO_DETECT, init() will also try to automatically detect a sensor. Auto detection will stop as soon as the first sensor was found; if you have multiple sensor types on the bus, use the 'sensorType' argument of the constructor to control which sensor type will be instantiated.
To read out the sensor use readSample(), followed by getTemperature() and getHumidity() to retrieve the values from the sample
Returns true if communication with a sensor on the bus was successful, false otherwise
| bool SHTSensor::readSample | ( | ) |
Read new values from the sensor After the call, use getTemperature() and getHumidity() to retrieve the values Returns true if the sample was read and the values are cached
| bool SHTSensor::setAccuracy | ( | SHTAccuracy | newAccuracy | ) |
Change the sensor accurancy, if supported by the sensor Returns true if the accuracy was changed
|
static |
Auto-detectable sensor types. Note that the SHTC3, SHTW1 and SHTW2 share exactly the same driver as the SHTC1 and are thus not listed individually.
|
static |
Value reported by getHumidity() when the sensor is not initialized
|
static |
Value reported by getTemperature() when the sensor is not initialized