BayEOSArduino Library
SHT3x.h
1 /***************************************************
2  This is a library for the SHT3x Digital Humidity & Temp Sensor
3  with Software I2C
4 
5  it was adapted from
6  https://github.com/adafruit/Adafruit_SHT31
7 
8  ****************************************************/
9 
10 #if (ARDUINO >= 100)
11  #include "Arduino.h"
12 #else
13  #include "WProgram.h"
14 #endif
15 #include <Sleep.h>
16 
17 
18 #include <SoftI2C.h>
19 
20 
21 #define SHT31_DEFAULT_ADDR 0x44
22 #define SHT31_MEAS_HIGHREP_STRETCH 0x2C06
23 #define SHT31_MEAS_MEDREP_STRETCH 0x2C0D
24 #define SHT31_MEAS_LOWREP_STRETCH 0x2C10
25 #define SHT31_MEAS_HIGHREP 0x2400
26 #define SHT31_MEAS_MEDREP 0x240B
27 #define SHT31_MEAS_LOWREP 0x2416
28 #define SHT31_READSTATUS 0xF32D
29 #define SHT31_CLEARSTATUS 0x3041
30 #define SHT31_SOFTRESET 0x30A2
31 #define SHT31_HEATEREN 0x306D
32 #define SHT31_HEATERDIS 0x3066
33 
34 
35 class SHT3x : private SoftI2C {
36  public:
37  SHT3x(uint8_t dataPin, uint8_t clockPin, uint8_t address=SHT31_DEFAULT_ADDR );
38  int8_t measure(float* t, float* h,uint8_t timeoutcounter=30,bool sleep=false);
39  int8_t measureSleep(float* t, float* h,uint8_t timeoutcounter=30);
40  uint16_t readStatus(void);
41  void reset(void);
42  void heater(boolean);
43  uint8_t crc8(const uint8_t *data, int len);
44 
45  private:
46  int8_t writeCommand(uint16_t cmd);
47 };
48 
Definition: SHT3x.h:35
Definition: SoftI2C.h:13