Adafruit SHT31-D Library
Public Member Functions | List of all members
Adafruit_SHT31 Class Reference

#include <Adafruit_SHT31.h>

Public Member Functions

 Adafruit_SHT31 (TwoWire *theWire=&Wire)
 SHT31 constructor using i2c. More...
 
 ~Adafruit_SHT31 ()
 
bool begin (uint8_t i2caddr=SHT31_DEFAULT_ADDR)
 
float readTemperature (void)
 
float readHumidity (void)
 
bool readBoth (float *temperature_out, float *humidity_out)
 
uint16_t readStatus (void)
 
void reset (void)
 
void heater (bool h)
 
bool isHeaterEnabled ()
 Return sensor heater state. More...
 

Detailed Description

Driver for the Adafruit SHT31-D Temperature and Humidity breakout board.

Constructor & Destructor Documentation

◆ Adafruit_SHT31()

Adafruit_SHT31::Adafruit_SHT31 ( TwoWire *  theWire = &Wire)

SHT31 constructor using i2c.

Parameters
*theWireoptional wire

◆ ~Adafruit_SHT31()

Adafruit_SHT31::~Adafruit_SHT31 ( )

Destructor to free memory in use.

Member Function Documentation

◆ begin()

bool Adafruit_SHT31::begin ( uint8_t  i2caddr = SHT31_DEFAULT_ADDR)

Initialises the I2C bus, and assigns the I2C address to us.

Parameters
i2caddrThe I2C address to use for the sensor.
Returns
True if initialisation was successful, otherwise False.

◆ readTemperature()

float Adafruit_SHT31::readTemperature ( void  )

Gets a single temperature reading from the sensor.

Returns
A float value indicating the temperature.

◆ readHumidity()

float Adafruit_SHT31::readHumidity ( void  )

Gets a single relative humidity reading from the sensor.

Returns
A float value representing relative humidity.

◆ readBoth()

bool Adafruit_SHT31::readBoth ( float *  temperature_out,
float *  humidity_out 
)

Gets a reading of both temperature and relative humidity from the sensor.

Parameters
temperature_outWhere to write the temperature float.
humidity_outWhere to write the relative humidity float.
Returns
True if the read was successful, false otherwise

◆ readStatus()

uint16_t Adafruit_SHT31::readStatus ( void  )

Gets the current status register contents.

Returns
The 16-bit status register.

◆ reset()

void Adafruit_SHT31::reset ( void  )

Performs a reset of the sensor to put it into a known state.

◆ heater()

void Adafruit_SHT31::heater ( bool  h)

Enables or disabled the heating element.

Parameters
hTrue to enable the heater, False to disable it.

◆ isHeaterEnabled()

bool Adafruit_SHT31::isHeaterEnabled ( )

Return sensor heater state.

Returns
heater state (TRUE = enabled, FALSE = disabled)

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