-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAdafruit_AM2315.h
executable file
·43 lines (34 loc) · 1.13 KB
/
Adafruit_AM2315.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
41
42
#ifndef Adafruit_AM2315_sensor
#define Adafruit_AM2315_sensor
/***************************************************
This is a library for the AM2315 Humidity Pressure & Temp Sensor
Designed specifically to work with the AM2315 sensor from Adafruit
----> https://www.adafruit.com/products/1293
These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "Wire.h"
#define AM2315_I2CADDR 0x5C
#define AM2315_READREG 0x03
class Adafruit_AM2315 {
public:
Adafruit_AM2315();
boolean begin(void);
float readTemperature(void);
float readHumidity(void);
bool readTemperatureAndHumidity(float&, float&);
private:
boolean readData(void);
float humidity, temp;
};
#endif