Adafruit AM2315 Library
Adafruit_AM2315.h
1 /***************************************************
2  This is a library for the AM2315 Humidity Pressure & Temp Sensor
3 
4  Designed specifically to work with the AM2315 sensor from Adafruit
5  ----> https://www.adafruit.com/products/1293
6 
7  These displays use I2C to communicate, 2 pins are required to
8  interface
9  Adafruit invests time and resources providing this open source code,
10  please support Adafruit and open-source hardware by purchasing
11  products from Adafruit!
12 
13  Written by Limor Fried/Ladyada for Adafruit Industries.
14  BSD license, all text above must be included in any redistribution
15  ****************************************************/
16 
17 #if (ARDUINO >= 100)
18 #include "Arduino.h"
19 #else
20 #include "WProgram.h"
21 #endif
22 
23 #include <Adafruit_I2CDevice.h>
24 
25 #define AM2315_I2CADDR 0x5C
26 #define AM2315_READREG 0x03
27 
30 public:
31  Adafruit_AM2315(TwoWire *theI2C = &Wire);
32  boolean begin(void);
33  float readTemperature(void);
34  float readHumidity(void);
35  bool readTemperatureAndHumidity(float *, float *);
36 
37 private:
38  Adafruit_I2CDevice *i2c_dev = NULL;
39  boolean readData(void);
40  float humidity, temp;
41  uint32_t lastreading;
42 };
Adafruit_AM2315(TwoWire *theI2C=&Wire)
Instantiates a new AM2320 class.
Definition: Adafruit_AM2315.cpp:30
float readTemperature(void)
Read and return the temperature, note you can only read once every 2 seconds.
Definition: Adafruit_AM2315.cpp:123
float readHumidity(void)
Read and return the humidity, note you can only read once every 2 seconds.
Definition: Adafruit_AM2315.cpp:136
Definition: Adafruit_AM2315.h:29
bool readTemperatureAndHumidity(float *, float *)
This method returns both temperature and humidity in a single call and using a single I2C request...
Definition: Adafruit_AM2315.cpp:156
boolean begin(void)
Setups the hardware.
Definition: Adafruit_AM2315.cpp:41