Finally I have ported a library for CCS811 (AMS) . You can get it here for tests (see attachmens). I'll add it to next beta.
You have to use clock stretching enable Wire library from there https://forum.z-wave.me/viewtopic.php?f=3427&t=28957 to get it work.
Test sketch code
Code: Select all
#define MY_SERIAL Serial0
#include <ZUNO_CCS811.h>
ZUNO_CCS811 ccs811;
CCS811_Environment env_data = {500, 2500}; // <--- You need an external humidity & temperature sensor like DHT22 or BME280 to make it accurate, Here is default values 50.0% 25.00*C
void setup() {
MY_SERIAL.begin(115200);
if(ccs811.begin()){
MY_SERIAL.println("CCS811 found!");
ccs811.setEnvironmentalData(&env_data);
}
}
void loop() {
if(ccs811.readData() & CCS811_STATUS_DATAREADY){
MY_SERIAL.print("CO2: ");
MY_SERIAL.print(ccs811.geteCO2());
MY_SERIAL.println(" ppm");
MY_SERIAL.print("VOC: ");
MY_SERIAL.print(ccs811.getTVOC());
MY_SERIAL.println(" ppb");
}
delay(5000);
}