Adafruit SHT31-D Library
Adafruit_SHT31.h
Go to the documentation of this file.
1 
20 #ifndef ADAFRUIT_SHT31_H
21 #define ADAFRUIT_SHT31_H
22 
23 #include "Arduino.h"
24 #include <Adafruit_I2CDevice.h>
25 
26 #define SHT31_DEFAULT_ADDR 0x44
27 #define SHT31_MEAS_HIGHREP_STRETCH \
28  0x2C06
29 #define SHT31_MEAS_MEDREP_STRETCH \
30  0x2C0D
31 #define SHT31_MEAS_LOWREP_STRETCH \
32  0x2C10
33 #define SHT31_MEAS_HIGHREP \
34  0x2400
35 #define SHT31_MEAS_MEDREP \
36  0x240B
37 #define SHT31_MEAS_LOWREP \
38  0x2416
39 #define SHT31_READSTATUS 0xF32D
40 #define SHT31_CLEARSTATUS 0x3041
41 #define SHT31_SOFTRESET 0x30A2
42 #define SHT31_HEATEREN 0x306D
43 #define SHT31_HEATERDIS 0x3066
44 #define SHT31_REG_HEATER_BIT 0x0d
46 extern TwoWire Wire;
52 class Adafruit_SHT31 {
53 public:
54  Adafruit_SHT31(TwoWire *theWire = &Wire);
55  ~Adafruit_SHT31();
56 
57  bool begin(uint8_t i2caddr = SHT31_DEFAULT_ADDR);
58  float readTemperature(void);
59  float readHumidity(void);
60  bool readBoth(float *temperature_out, float *humidity_out);
61  uint16_t readStatus(void);
62  void reset(void);
63  void heater(bool h);
64  bool isHeaterEnabled();
65 
66 private:
70  float humidity;
71 
75  float temp;
76 
77  bool readTempHum(void);
78  bool writeCommand(uint16_t cmd);
79 
80  TwoWire *_wire;
81  Adafruit_I2CDevice *i2c_dev = NULL;
82 };
83 
84 #endif
TwoWire Wire
#define SHT31_DEFAULT_ADDR
Definition: Adafruit_SHT31.h:26
Definition: Adafruit_SHT31.h:52