Note: These devices are all NRD except for the TE parts.
This repository contains an Arduino library for the following Sensirion devices:
- SHT20
- SHT21
- SHT21A
- SHT25 The following Silicon Labs devices:
- Si7006
- Si7020
- Si7021 The following TE Connectivity (Measurement Specialties) devices:
- HTU20
- HTU21
The library uses I²C transactions and allows to select the I²C controller if there is more than one.
#include <Wire.h> // #include <i2c_t3.h> on the Teensy platform.
#include "src/SHT2x.h"
SHT2x sensor(Wire);
//HTU2x sensor(Wire);
//Si702x sensor(Wire);
void setup() {
Wire.begin();
Serial.begin(115200);
}
void loop() {
// The call to readTemp() will automatically block for the time the measurement takes to complete
Serial.print(sensor.readTemp()); // Read the temperarture as a float in °C
Serial.println(" °C");
Serial.print(sensor.readHumdity()); // Read the humidity as a float in %rH
Serial.println(" %rH");
delay(2000);
}
Currently the library does not support the Arduino library manager, so it is highly recommended to copy the full library to a subfolder called
src/
within your Arduino project.