BayEOSArduino Library
CO2K30.h
1 // This is a library for the K30 CO2 module connected to Arduino via I2C
2 #ifndef __CO2K30_H__
3 #define __CO2K30_H__
4 
5 #include "Arduino.h"
6 #include <Wire.h>
7 
8 /*=========================================================================
9 I2C ADDRESS/BITS
10 -----------------------------------------------------------------------*/
11 #define CO2K30_ADDRESS (0x68)
12 /*=========================================================================*/
13 
14 class CO2K30
15  {
16  public:
17  CO2K30(void);
18  void begin(void);
19 
20 /*
21  * readRAM Commands
22  *
23  * reads specific RAM address and transforms result into float
24  * returns NAN on checksum error
25  */
26  float readCO2(void);
27  float readABC(void);
28  /*
29  * writeRAM Commands
30  *
31  * returns
32  * 0 on success
33  * 1 on not complete
34  * 2 on checksum error
35  * 3 on other error
36  */
37  uint8_t zeroCalibration(void);
38  uint8_t backgroundCalibration(void);
39  uint8_t disableABC(void);
40 
41  private:
42  float readRAM(uint8_t memaddr);
43  uint8_t writeRAM(uint8_t memaddr,uint8_t* command, uint8_t length);
44  float readEEPROM(uint8_t memaddr);
45  uint8_t writeEEPROM(uint8_t memaddr,uint8_t* command, uint8_t length);
46  uint8_t i;
47  uint8_t buffer[4];
48  int value;
49 
50  };
51 
52 #endif
Definition: CO2K30.h:15