Reference
API Description
/**
* @brief Init Wire, and perform software reset of the sensor, let the sensor enter sleep mode, and wake it up when necessary
*/
void begin();
/**
* @brief When in sleep mode, the sensor needs to be awakened before communicating
*/
void wakeup();
/**
* @brief Set sensor to sleep mode. When done, the sensor cannot obtain data before waking up
*/
void sleep();
/**
* @brief Init board I2C
*/
void begin();
/**
* @brief Get temperature data
* @param mode Sensor working mode
* @n SHTC3:
* @n PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* @n PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* @n PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* @n PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
* @n SHT40:
* @n PRECISION_HIGH measure T & RH with high precision (high repeatability)
* @n PRECISION_MID measure T & RH with medium precision (medium repeatability)
* @n PRECISION_LOW measure T & RH with lowest precision (low repeatability)
* @return Return Temperature value, unit: ℃ Return MODE_ERR: invalid mode
*/
float getTemperature(uint16_t mode);
/**
* @brief Get himidity data
* @param mode Sensor working mode
* @n SHTC3:
* @n PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* @n PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* @n PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* @n PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
* @n SHT40:
* @n PRECISION_HIGH measure T & RH with high precision (high repeatability)
* @n PRECISION_MID measure T & RH with medium precision (medium repeatability)
* @n PRECISION_LOW measure T & RH with lowest precision (low repeatability)
* @return Return, humidity value, unit: %RH Return MODE_ERR: invalid mode
*/
float getHumidity(uint16_t mode);
/**
* @brief Get temperature and humidity data
* @param tem Reference for storing temperature data
* @param hum Reference for storing humidity data
* @param mode Sensor working mode
* @n SHTC3:
* @n PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* @n PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* @n PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* @n PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
* @n SHT40:
* @n PRECISION_HIGH measure T & RH with high precision (high repeatability)
* @n PRECISION_MID measure T & RH with medium precision (medium repeatability)
* @n PRECISION_LOW measure T & RH with lowest precision (low repeatability)
* @return Return true, mode setting succeed; Return false, mode setting fails
*/
bool getTemHum(float &tem, float &hum,uint16_t mode);
/**
* @brief Get sensor unique identifier
* @return Return sensor unique identifier for success, return 0 for failure
*/
uint32_t getDeviceID();
/**
* @brief software reset
*/
void softwareReset() ;
/**
* @brief Obtain raw data of temperature and humidity
* @param temp Pointer to the address of the original value of the temperature
* @param hun Pointer to the address of the original value of the humidity
* @return Is the data obtained correct? return true The data is correct ; return false The data is incorrect
*/
bool getTandRHRawData(uint16_t *temp, uint16_t *hum);
Was this article helpful?
