UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

SHT1X Class

Module: sht1x

This driver was tested with a DFRobot SHT10 Temperature and Humidity sensor. This driver should work on all SHT1X devices.
It requires a 10K pull-up resistor connected to the data pin. The sensor can be run at differing voltages from 2.5v to 5v.

Methods

SHT1X

(
  • clk_pin
  • data_pin
)
Number

SHT1X object constructor

Parameters:

  • clk_pin Number

    Specify the GPIO pin to use for the clock.

  • data_pin Number

    Specify the GPIO pin to use for data.

Returns:

Number:

reset

()

Perform a soft reset of the device.

update

()

Query the device and store the latest values. You must call this function before querying the temperature or the humidity.

getTemperature

() Number

Query the temperature in degrees Celsius. update() must have been called prior to calling this function.

Returns:

Number:

The temperature in Celsius

getHumidity

() Number

Query the relative humidity. update() must have been called prior to calling this function.

Returns:

Number:

The relative humidity.

readStatus

() Number

Read the status register.

Returns:

Number:

The contents of the status register.

writeStatus

(
  • status
)
Upm_result_t

Write a value to the status register.

Parameters:

  • status Number

    The uint8_t to write to the register.

Returns:

Upm_result_t:

UPM result

setVolts

(
  • volts
)

The Vdd voltage the sensor is being driven at can affect the temperature measurements. This function allows you to specify a voltage as close as you are using to power the sensor, so that the appropriate compensation can be made. By default, the coefficients are set for 5v operation.

Parameters:

  • volts SHT1X_VOLTS_T

    One of the SHT1X_VOLTS_T values.