-
Notifications
You must be signed in to change notification settings - Fork 118
/
SHT1x.h
40 lines (37 loc) · 1.03 KB
/
SHT1x.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* SHT1x Library
*
* Copyright 2009 Jonathan Oxer <[email protected]> / <www.practicalarduino.com>
* Based on previous work by:
* Maurice Ribble: <www.glacialwanderer.com/hobbyrobotics/?p=5>
* Wayne ?: <ragingreality.blogspot.com/2008/01/ardunio-and-sht15.html>
*
* Manages communication with SHT1x series (SHT10, SHT11, SHT15)
* temperature / humidity sensors from Sensirion (www.sensirion.com).
*/
#ifndef SHT1x_h
#define SHT1x_h
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
class SHT1x
{
public:
SHT1x(int dataPin, int clockPin);
float readHumidity();
float readTemperatureC();
float readTemperatureF();
private:
int _dataPin;
int _clockPin;
int _numBits;
float readTemperatureRaw();
int shiftIn(int _dataPin, int _clockPin, int _numBits);
void sendCommandSHT(int _command, int _dataPin, int _clockPin);
void waitForResultSHT(int _dataPin);
int getData16SHT(int _dataPin, int _clockPin);
void skipCrcSHT(int _dataPin, int _clockPin);
};
#endif