Reference
Library
- Download and install the CCS811 Library and examples. (About how to install the library?)
API Description
/**
* @brief Judge if the data can be read
* @return true when the reading is successful, false means it fails to read.
*/
bool checkDataReady();
/**
* @brief Set environment parameter
* @param temperature Input temperature value, unit: centigrade, range (-40~85℃)
* @param humidity Input humidity value, unit: RH, range (0~100)
*/
void setInTemHum(float temperature, float humidity);
/**
* @brief Measurement parameter configuration
* @param mode:in typedef enum{
* eClosed, //Idle (Measurements are disabled in this mode)
* eCycle_1s, //Constant power mode, IAQ measurement every second
* eCycle_10s, //Pulse heating mode IAQ measurement every 10 seconds
* eCycle_60s, //Low power pulse heating mode IAQ measurement every 60 seconds
* eCycle_250ms //Constant power mode, sensor measurement every 250ms 1xx: Reserved modes (For future use)
* }eCycle_t;
* @param thresh:0 for Interrupt mode operates normally; 1 for interrupt mode only asserts the nINT signal (driven low) if the new
* @param interrupt:0 for Interrupt generation is disabled; 1 for the nINT signal is asserted (driven low) when a new sample is ready in
*/
setMeasurementMode(eCycle_t mode, uint8_t thresh = 0, uint8_t interrupt = 0),
/**
* @brief Get the current carbon dioxide concentration
* @return current carbon dioxide concentration, unit:ppm
*/
uint16_t getCO2PPM();
/**
* @brief Get current TVOC concentration
* @return Return current TVOC concentration, unit: ppb
*/
uint16_t getTVOCPPB();
/**
*@brief get the current baseline number
*@return a Hexadecimal number of the current baseline number
*/
uint16_t readBaseLine();
/**
*@brief write a baseline number into register
*@param a Hexadecimal number get from getBaseLine.ino
*/
void writeBaseLine(uint16_t baseLine);
Other Supplementary Information
The chip has stretched the clock in IIC. So, it is not compatible with some controllers, such as Raspberry Pi.
Please run the sensor for 48hours when using it for the first time.
Was this article helpful?
