Skip to content
Frederic Pillon edited this page May 28, 2024 · 2 revisions

HTS221

Arduino library to support the HTS221 capacitive digital sensor for relative humidity and temperature.

API

  • HTS221Sensor(TwoWire*, uint8_t): class constructor
    Params pointer to the I2C instance
    Params (optional) address of the component's instance

  • Enable: enable sensor
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • Disable: disable sensor
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • ReadID(uint8_t*): read ID address
    Params pointer where store the ID of the device
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • Reset: reboot memory content
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • GetHumidity(float*): read output register and calculate the humidity
    Params pointer to data
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • GetTemperature(float*): read output register and calculate the temperature
    Params pointer to data
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • GetODR(float*): get the output data rate mode
    Params pointer to data
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • SetODR(float*): set the output data rate mode
    Params data rate to be set
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • ReadReg(uint8_t, uint8_t*): read data from register
    Params register address
    Params pointer to register data
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

  • WriteReg(uint8_t, uint8_t): write data to register
    Params register address
    Params register data
    Returns HTS221_STATUS_OK in case of success, an error code otherwise

Note

This library uses the Wire library presents in the STM32 core by default.

Examples

  • DISCO_IOT_DataLogTerminal: reads temperature and humidity values and prints them.

Source

You can find the source files at
https://github.com/stm32duino/HTS221

Documentation

The HTS221 datasheet is available at
http://www.st.com/content/st_com/en/products/mems-and-sensors/humidity-sensors/hts221.html

Clone this wiki locally